mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Merge remote-tracking branch 'origin/master' into pr/1033
This commit is contained in:
@@ -29,7 +29,7 @@ describe "CustomersCtrl", ->
|
||||
expect(CurrentShop.shop).toEqual {}
|
||||
|
||||
describe "setting the shop on scope", ->
|
||||
customer = { id: 5, email: 'someone@email.com'}
|
||||
customer = { id: 5, email: 'someone@email.com', code: 'a'}
|
||||
customers = [customer]
|
||||
|
||||
beforeEach inject (pendingChanges) ->
|
||||
@@ -52,6 +52,12 @@ describe "CustomersCtrl", ->
|
||||
it "retrievs the list of customers", ->
|
||||
expect(scope.customers).toDeepEqual customers
|
||||
|
||||
it "finds customers by code", ->
|
||||
as = scope.findByCode('a')
|
||||
expect(as).toDeepEqual customers
|
||||
as = scope.findByCode('b')
|
||||
expect(as).toDeepEqual []
|
||||
|
||||
describe "scope.add", ->
|
||||
it "creates a new customer", ->
|
||||
email = "customer@example.org"
|
||||
|
||||
@@ -8,7 +8,8 @@ describe "AdminSimpleCreateOrderCycleCtrl", ->
|
||||
outgoing_exchange = {}
|
||||
|
||||
beforeEach ->
|
||||
scope = {}
|
||||
scope =
|
||||
$watch: jasmine.createSpy('$watch')
|
||||
order_cycle =
|
||||
coordinator_id: 123
|
||||
incoming_exchanges: [incoming_exchange]
|
||||
|
||||
@@ -15,6 +15,7 @@ describe "TagRulesCtrl", ->
|
||||
|
||||
inject ($rootScope, $controller) ->
|
||||
scope = $rootScope
|
||||
scope.enterprise_form = jasmine.createSpyObj('enterprise_form', ['$setDirty'])
|
||||
ctrl = $controller 'TagRulesCtrl', {$scope: scope, enterprise: enterprise}
|
||||
|
||||
describe "tagGroup start indices", ->
|
||||
@@ -27,6 +28,8 @@ describe "TagRulesCtrl", ->
|
||||
scope.addNewRuleTo(scope.tagGroups[0], "DiscountOrder")
|
||||
|
||||
it "adds a new rule of the specified type to the rules array for the tagGroup", ->
|
||||
expect(scope.enterprise_form.$setDirty).toHaveBeenCalled()
|
||||
|
||||
expect(scope.tagGroups[0].rules.length).toEqual 3
|
||||
expect(scope.tagGroups[0].rules[2].type).toEqual "TagRule::DiscountOrder"
|
||||
|
||||
|
||||
@@ -668,6 +668,9 @@ describe "AdminProductEditCtrl", ->
|
||||
spyOn $scope, "displaySuccess"
|
||||
spyOn BulkProducts, "updateVariantLists"
|
||||
spyOn DirtyProducts, "clear"
|
||||
|
||||
$scope.bulk_product_form = jasmine.createSpyObj('bulk_product_form', ['$setPristine'])
|
||||
|
||||
$scope.products = [
|
||||
{
|
||||
id: 1
|
||||
@@ -692,6 +695,7 @@ describe "AdminProductEditCtrl", ->
|
||||
$httpBackend.flush()
|
||||
$timeout.flush()
|
||||
expect($scope.displaySuccess).toHaveBeenCalled()
|
||||
expect($scope.bulk_product_form.$setPristine).toHaveBeenCalled
|
||||
expect(DirtyProducts.clear).toHaveBeenCalled()
|
||||
expect(BulkProducts.updateVariantLists).toHaveBeenCalled()
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@ describe 'OrderCycle controllers', ->
|
||||
EnterpriseFee = null
|
||||
|
||||
beforeEach ->
|
||||
scope = {}
|
||||
scope =
|
||||
order_cycle_form: jasmine.createSpyObj('order_cycle_form', ['$dirty'])
|
||||
$watch: jasmine.createSpy('$watch')
|
||||
event =
|
||||
preventDefault: jasmine.createSpy('preventDefault')
|
||||
OrderCycle =
|
||||
|
||||
Reference in New Issue
Block a user