filter.js: Add test coverage for group-pm-with.

Added one little additional test in
people.js to get up to 100% coverage.
This commit is contained in:
Cory Lynch 2017-09-24 13:46:24 -04:00
parent 1c0043ea47
commit 0da74f4d6d
2 changed files with 22 additions and 0 deletions

View File

@ -328,6 +328,27 @@ function make_sub(name, stream_id) {
type: 'private',
display_recipient: [{id: joe.user_id}],
}));
predicate = get_predicate([['group-pm-with', 'nobody@example.com']]);
assert(!predicate({
type: 'private',
display_recipient: [{id: joe.user_id}],
}));
predicate = get_predicate([['group-pm-with', 'Joe@example.com']]);
assert(predicate({
type: 'private',
display_recipient: [{id: joe.user_id}, {id: steve.user_id}, {id: me.user_id}],
}));
assert(!predicate({ // you must be a part of the group pm
type: 'private',
display_recipient: [{id: joe.user_id}, {id: steve.user_id}],
}));
assert(!predicate({
type: 'private',
display_recipient: [{id: steve.user_id}, {id: me.user_id}],
}));
assert(!predicate({type: 'stream'}));
}());
(function test_negated_predicates() {

View File

@ -572,6 +572,7 @@ initialize();
assert.equal(msg, 'Empty recipient list in message');
};
people.pm_with_user_ids(message);
people.group_pm_with_user_ids(message);
var charles = {
email: 'charles@example.com',