add it "lists products sorted by name" test

This commit is contained in:
Mohamed ABDELLANI
2022-10-24 09:00:41 +01:00
parent 732ebd8457
commit da9a4803ff

View File

@@ -31,6 +31,14 @@ module Reporting
expect(report.rows.first.producer).to eq supplier.name
expect(report.rows.first.hub).to eq distributor.name
end
it "lists products sorted by name" do
order.line_items[0].variant.product.update(name: "Cucumber")
order.line_items[1].variant.product.update(name: "Apple")
order.line_items[2].variant.product.update(name: "Banane")
product_names = report.rows.map(&:product).filter(&:present?)
expect(product_names).to eq(["Apple", "Banane", "Cucumber"])
end
end
end
end