mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-03 22:06:07 +00:00
Tests and patch for group filter
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
describe "filtering Groups", ->
|
||||
filterGroups = null
|
||||
groups = [{
|
||||
name: "test"
|
||||
long_description: "roger"
|
||||
enterprises: [{
|
||||
name: "kittens"
|
||||
}, {
|
||||
name: "kittens"
|
||||
}]
|
||||
}, {
|
||||
name: "blankness"
|
||||
long_description: "in the sky"
|
||||
enterprises: [{
|
||||
name: "ponies"
|
||||
}, {
|
||||
name: "ponies"
|
||||
}]
|
||||
}
|
||||
]
|
||||
|
||||
beforeEach ->
|
||||
module 'Darkswarm'
|
||||
inject ($filter) ->
|
||||
filterGroups = $filter('groups')
|
||||
|
||||
it "filters by name", ->
|
||||
expect(filterGroups(groups, "test")[0]).toBe groups[0]
|
||||
|
||||
it "filters by description", ->
|
||||
expect(filterGroups(groups, "sky")[0]).toBe groups[1]
|
||||
|
||||
it "filters by enterprise name", ->
|
||||
expect(filterGroups(groups, "ponies")[0]).toBe groups[1]
|
||||
Reference in New Issue
Block a user