Fix users removing last item of confirmed order on /cart page

This commit is contained in:
Matthew Rieger
2020-12-13 17:15:11 -05:00
committed by Andy Brett
parent b3610e035d
commit 651bdad7b9
4 changed files with 32 additions and 9 deletions

View File

@@ -222,6 +222,16 @@ describe 'Cart service', ->
expect(li.quantity).toEqual 1
expect(li.max_quantity).toEqual 1
describe "when modifying a confirmed order", ->
it "displays flash error when attempting to remove final item", ->
spyOn(RailsFlashLoader, 'loadFlash')
li = {variant: {id: 1}, quantity: 3}
Cart.line_items_finalised = [li]
Cart.check_last_finalised_item()
expect(RailsFlashLoader.loadFlash).toHaveBeenCalledWith(
{error: t 'orders_cannot_remove_the_final_item'}
)
it "pops the queue", ->
Cart.update_enqueued = true
spyOn(Cart, 'scheduleUpdate')