From da9a4803ff1c9af4b905b1629080d7992fb6ca08 Mon Sep 17 00:00:00 2001 From: Mohamed ABDELLANI Date: Mon, 24 Oct 2022 09:00:41 +0100 Subject: [PATCH] add it "lists products sorted by name" test --- ...er_cycle_supplier_totals_by_distributor_report_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/lib/reports/orders_and_fulfillment/order_cycle_supplier_totals_by_distributor_report_spec.rb b/spec/lib/reports/orders_and_fulfillment/order_cycle_supplier_totals_by_distributor_report_spec.rb index a6f8e0a9d6..807089057e 100644 --- a/spec/lib/reports/orders_and_fulfillment/order_cycle_supplier_totals_by_distributor_report_spec.rb +++ b/spec/lib/reports/orders_and_fulfillment/order_cycle_supplier_totals_by_distributor_report_spec.rb @@ -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