From bf4ce90f988381ca1c293cb61e7dfa9469349fcd Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Thu, 14 Feb 2019 15:56:44 +0000 Subject: [PATCH] Add product.on_hand and product.on_demand positive test, these should be returned if no variants are provided in the input Also, removed product.count_on_hand negative test (there's no such attriubte in v2) and added product.on_hand, this should not be returned because a variant is provided --- .../admin/bulk_product_update_spec.js.coffee | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/spec/javascripts/unit/admin/bulk_product_update_spec.js.coffee b/spec/javascripts/unit/admin/bulk_product_update_spec.js.coffee index c1c34cbe6b..a26fdd523e 100644 --- a/spec/javascripts/unit/admin/bulk_product_update_spec.js.coffee +++ b/spec/javascripts/unit/admin/bulk_product_update_spec.js.coffee @@ -166,7 +166,22 @@ describe "filtering products for submission to database", -> variant_unit_scale: 1 ] - # TODO Not an exhaustive test, is there a better way to do this? + it "returns stock properties of a product if no variant is provided", -> + available_on = new Date() + + testProduct = + id: 1 + name: "TestProduct" + on_hand: 0 + on_demand: false + + expect(filterSubmitProducts([testProduct])).toEqual [ + id: 1 + name: "TestProduct" + on_hand: 0 + on_demand: false + ] + it "only returns the properties of products which ought to be updated", -> available_on = new Date() @@ -183,12 +198,11 @@ describe "filtering products for submission to database", -> shipping_category_id: null created_at: null updated_at: null - count_on_hand: 0 + on_hand: 0 + on_demand: false producer_id: 5 - group_buy: null group_buy_unit_size: null - on_demand: false master: id: 2 unit_value: 250