mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
BOM: fetchOrders sends request to API and resetOrders stores returned data
This commit is contained in:
@@ -20,4 +20,21 @@ describe "AdminOrderMgmtCtrl", ->
|
||||
httpBackend.flush()
|
||||
expect(scope.suppliers).toEqual "list of suppliers"
|
||||
expect(scope.fetchOrders.calls.length).toEqual 1
|
||||
expect(scope.spree_api_key_ok).toEqual true
|
||||
expect(scope.spree_api_key_ok).toEqual true
|
||||
|
||||
describe "fetching orders", ->
|
||||
it "makes a standard call to dataFetcher", ->
|
||||
httpBackend.expectGET("/api/orders?template=bulk_index").respond "list of orders"
|
||||
scope.fetchOrders()
|
||||
|
||||
it "calls resetOrders after data has been received", ->
|
||||
spyOn scope, "resetOrders"
|
||||
httpBackend.expectGET("/api/orders?template=bulk_index").respond "list of orders"
|
||||
scope.fetchOrders()
|
||||
httpBackend.flush()
|
||||
expect(scope.resetOrders).toHaveBeenCalledWith "list of orders"
|
||||
|
||||
describe "resetting orders", ->
|
||||
it "sets the value of $scope.orders to the data received", ->
|
||||
scope.resetOrders "list of orders"
|
||||
expect(scope.orders).toEqual "list of orders"
|
||||
Reference in New Issue
Block a user