Convert all calls to variant.count_on_hand to variant.on_hand

This commit is contained in:
luisramos0
2019-02-18 21:54:07 +00:00
parent 8f192c39fb
commit f0842fcbe5
32 changed files with 99 additions and 100 deletions

View File

@@ -98,7 +98,7 @@ describe "VariantOverridesCtrl", ->
beforeEach ->
# Ideally, count_on_hand is blank when the variant is on demand. However, this rule is not
# enforced.
variant = {id: 2, on_demand: true, count_on_hand: 20, on_hand: "On demand"}
variant = {id: 2, on_demand: true, on_hand: 20, on_hand: "On demand"}
it "clears count_on_hand when variant override uses producer stock settings", ->
scope.variantOverrides[123][2] = {on_demand: null, count_on_hand: 1}
@@ -162,7 +162,7 @@ describe "VariantOverridesCtrl", ->
beforeEach ->
# Ideally, count_on_hand is blank when the variant is on demand. However, this rule is not
# enforced.
variant = {id: 2, on_demand: true, count_on_hand: 20, on_hand: t("on_demand")}
variant = {id: 2, on_demand: true, on_hand: 20, on_hand: t("on_demand")}
it "is 'On demand' when variant override uses producer stock settings", ->
scope.variantOverrides[123][2] = {on_demand: null, count_on_hand: 1}
@@ -183,7 +183,7 @@ describe "VariantOverridesCtrl", ->
variant = null
beforeEach ->
variant = {id: 2, on_demand: false, count_on_hand: 20, on_hand: 20}
variant = {id: 2, on_demand: false, on_hand: 20, on_hand: 20}
it "is variant count on hand when variant override uses producer stock settings", ->
scope.variantOverrides[123][2] = {on_demand: null, count_on_hand: 1}

View File

@@ -183,7 +183,7 @@ describe "filtering products for submission to database", ->
shipping_category_id: null
created_at: null
updated_at: null
count_on_hand: 0
on_hand: 0
producer_id: 5
group_buy: null

View File

@@ -145,11 +145,11 @@ describe 'Cart service', ->
expect(li.max_quantity).toEqual 0
it "resets the count on hand available", ->
li = {variant: {id: 1, count_on_hand: 10}, quantity: 5}
li = {variant: {id: 1, on_hand: 10}, quantity: 5}
Cart.line_items = [li]
stockLevels = {1: {quantity: 0, max_quantity: 0, on_hand: 0}}
Cart.compareAndNotifyStockLevels stockLevels
expect(li.variant.count_on_hand).toEqual 0
expect(li.variant.on_hand).toEqual 0
describe "when the quantity available is less than that requested", ->
it "reduces the quantity in the cart", ->
@@ -172,7 +172,7 @@ describe 'Cart service', ->
Cart.line_items = [li]
stockLevels = {1: {quantity: 5, on_hand: 6}}
Cart.compareAndNotifyStockLevels stockLevels
expect(li.variant.count_on_hand).toEqual 6
expect(li.variant.on_hand).toEqual 6
describe "when the client-side quantity has been increased during the request", ->
it "does not reset the quantity", ->