mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
Adding default tag rules
This commit is contained in:
@@ -7,6 +7,7 @@ describe "TagRulesCtrl", ->
|
||||
module('admin.tagRules')
|
||||
enterprise =
|
||||
id: 45
|
||||
default_tag_group: { tags: "", rules: [{ id: 7, preferred_customer_tags: "trusted" }] }
|
||||
tag_groups: [
|
||||
{ tags: "member", rules: [{ id: 1, preferred_customer_tags: "member" }, { id: 2, preferred_customer_tags: "member" }] },
|
||||
{ tags: "volunteer", rules: [{ id: 3, preferred_customer_tags: "local" }] }
|
||||
@@ -18,8 +19,8 @@ describe "TagRulesCtrl", ->
|
||||
|
||||
describe "tagGroup start indices", ->
|
||||
it "updates on initialization", ->
|
||||
expect(scope.tagGroups[0].startIndex).toEqual 0
|
||||
expect(scope.tagGroups[1].startIndex).toEqual 2
|
||||
expect(scope.tagGroups[0].startIndex).toEqual 1
|
||||
expect(scope.tagGroups[1].startIndex).toEqual 3
|
||||
|
||||
describe "adding a new tag group", ->
|
||||
beforeEach ->
|
||||
@@ -30,8 +31,8 @@ describe "TagRulesCtrl", ->
|
||||
expect(scope.tagGroups[0].rules[2].type).toEqual "TagRule::DiscountOrder"
|
||||
|
||||
it "updates tagGroup start indices", ->
|
||||
expect(scope.tagGroups[0].startIndex).toEqual 0
|
||||
expect(scope.tagGroups[1].startIndex).toEqual 3
|
||||
expect(scope.tagGroups[0].startIndex).toEqual 1
|
||||
expect(scope.tagGroups[1].startIndex).toEqual 4
|
||||
|
||||
describe "deleting a tag group", ->
|
||||
describe "where the rule is not in the rule list for the tagGroup", ->
|
||||
@@ -58,8 +59,8 @@ describe "TagRulesCtrl", ->
|
||||
expect(scope.tagGroups[0].rules.indexOf(rule)).toEqual -1
|
||||
|
||||
it "updates tagGroup start indices", ->
|
||||
expect(scope.tagGroups[0].startIndex).toEqual 0
|
||||
expect(scope.tagGroups[1].startIndex).toEqual 1
|
||||
expect(scope.tagGroups[0].startIndex).toEqual 1
|
||||
expect(scope.tagGroups[1].startIndex).toEqual 2
|
||||
|
||||
describe "without an id", ->
|
||||
rule = null
|
||||
@@ -75,5 +76,5 @@ describe "TagRulesCtrl", ->
|
||||
expect(scope.tagGroups[0].rules.indexOf(rule)).toEqual -1
|
||||
|
||||
it "updates tagGroup start indices", ->
|
||||
expect(scope.tagGroups[0].startIndex).toEqual 0
|
||||
expect(scope.tagGroups[1].startIndex).toEqual 1
|
||||
expect(scope.tagGroups[0].startIndex).toEqual 1
|
||||
expect(scope.tagGroups[1].startIndex).toEqual 2
|
||||
|
||||
Reference in New Issue
Block a user