refactor: Clean up can_mark_messages_read.

We now explicitly enumerate various cases, which
should make it easier to change this code.
This commit is contained in:
Steve Howell
2020-01-08 11:59:24 +00:00
committed by Tim Abbott
parent bb579f8823
commit 316eda071d
2 changed files with 44 additions and 7 deletions

View File

@@ -275,11 +275,17 @@ run_test('can_mark_messages_read', () => {
{ operator: 'pm-with', operand: 'joe@example.com,' },
];
const pm_with_negated = [
{ operator: 'pm-with', operand: 'joe@example.com,', negated: true},
];
const group_pm = [
{ operator: 'pm-with', operand: 'joe@example.com,STEVE@foo.com' },
];
filter = new Filter(pm_with);
assert(filter.can_mark_messages_read());
filter = new Filter(pm_with_negated);
assert(!filter.can_mark_messages_read());
filter = new Filter(group_pm);
assert(filter.can_mark_messages_read());
assert_not_mark_read_with_is_operands(group_pm);