Switch from old success/error to modern then/catch structure

Catch() will get a few more errors then errors()

Also, add try/catch inside catch to detect any errors parsing the
response error payload
This commit is contained in:
Luis Ramos
2020-04-10 12:21:42 +01:00
parent b92e858448
commit 7414047b92
2 changed files with 14 additions and 9 deletions

View File

@@ -119,6 +119,7 @@ describe 'Checkout service', ->
it "puts errors into the scope", ->
$httpBackend.expectPUT("/checkout.json").respond 400, {errors: {error: "frogs"}}
Checkout.submit()
$httpBackend.flush()
expect(Checkout.errors).toEqual {error: "frogs"}