mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
Cover report content with specs
This commit is contained in:
committed by
Kristina Lim
parent
fdd8c06823
commit
7bc735eea3
@@ -5,12 +5,14 @@ describe OpenFoodNetwork::OrdersAndFulfillmentsReport do
|
||||
|
||||
let(:distributor) { create(:distributor_enterprise) }
|
||||
let(:order_cycle) { create(:simple_order_cycle) }
|
||||
let(:address) { create(:address) }
|
||||
let(:order) {
|
||||
create(
|
||||
:order,
|
||||
completed_at: 1.day.ago,
|
||||
order_cycle: order_cycle,
|
||||
distributor: distributor
|
||||
distributor: distributor,
|
||||
bill_address: address
|
||||
)
|
||||
}
|
||||
let(:line_item) { build(:line_item) }
|
||||
@@ -136,4 +138,28 @@ describe OpenFoodNetwork::OrdersAndFulfillmentsReport do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "order_cycle_customer_totals" do
|
||||
let(:product) { line_item.product }
|
||||
let(:fuji) { product.variants.first }
|
||||
let(:items) {
|
||||
report = described_class.new(admin_user, { report_type: "order_cycle_customer_totals" }, true)
|
||||
OpenFoodNetwork::OrderGrouper.new(report.rules, report.columns).table(report.table_items)
|
||||
}
|
||||
|
||||
it "has a product row" do
|
||||
product_name_field = items.first[5]
|
||||
expect(product_name_field).to eq product.name
|
||||
end
|
||||
|
||||
it "has a summary row" do
|
||||
product_name_field = items.last[5]
|
||||
expect(product_name_field).to eq "TOTAL"
|
||||
end
|
||||
|
||||
it "contain the right SKU" do
|
||||
sku_field = items.first[23]
|
||||
expect(sku_field).to eq product.sku
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user