mirror of https://github.com/zulip/zulip.git
Add test_predicates() to filter.js tests
(imported from commit 551f396b4458ac529858f91f693b424bc7d06b8c)
This commit is contained in:
parent
269f3670cd
commit
767a8ae400
|
@ -19,11 +19,6 @@ var Filter = global.Filter;
|
|||
var filter = new Filter(operators);
|
||||
|
||||
assert.deepEqual(filter.operators(), operators);
|
||||
|
||||
var predicate = filter.predicate();
|
||||
assert(predicate({type: 'stream', stream: 'foo', subject: 'bar'}));
|
||||
assert(!predicate({type: 'stream', stream: 'foo', subject: 'whatever'}));
|
||||
|
||||
assert.deepEqual(filter.operands('stream'), ['foo']);
|
||||
|
||||
assert(filter.has_operator('stream'));
|
||||
|
@ -50,3 +45,14 @@ var Filter = global.Filter;
|
|||
assert.deepEqual(Filter.canonicalize_tuple(['Stream', 'Denmark']), ['stream', 'denmark']);
|
||||
}());
|
||||
|
||||
(function test_predicates() {
|
||||
var operators = [['stream', 'Foo'], ['topic', 'Bar']];
|
||||
var filter = new Filter(operators);
|
||||
|
||||
var predicate = filter.predicate();
|
||||
assert(predicate({type: 'stream', stream: 'foo', subject: 'bar'}));
|
||||
assert(!predicate({type: 'stream', stream: 'foo', subject: 'whatever'}));
|
||||
}());
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue