node tests: Localize all_obj consts.

This commit is contained in:
Steve Howell 2021-03-15 15:39:34 +00:00 committed by Steve Howell
parent d7d357f61e
commit 3b75674b08
1 changed files with 9 additions and 7 deletions

View File

@ -395,12 +395,12 @@ run_test("sort_recipients", () => {
]); ]);
}); });
run_test("sort_recipients all mention", () => {
const all_obj = ct.broadcast_mentions()[0]; const all_obj = ct.broadcast_mentions()[0];
assert.equal(all_obj.email, "all"); assert.equal(all_obj.email, "all");
assert.equal(all_obj.is_broadcast, true); assert.equal(all_obj.is_broadcast, true);
assert.equal(all_obj.idx, 0); assert.equal(all_obj.idx, 0);
run_test("sort_recipients all mention", () => {
// Test person email is "all" or "everyone" // Test person email is "all" or "everyone"
const test_objs = matches.concat([all_obj]); const test_objs = matches.concat([all_obj]);
@ -448,6 +448,8 @@ run_test("sort_recipients dup bots", () => {
}); });
run_test("sort_recipients dup alls", () => { run_test("sort_recipients dup alls", () => {
const all_obj = ct.broadcast_mentions()[0];
// full_name starts with same character but emails are 'all' // full_name starts with same character but emails are 'all'
const test_objs = [all_obj, a_user, all_obj]; const test_objs = [all_obj, a_user, all_obj];
@ -507,10 +509,10 @@ run_test("test compare directly", () => {
// This is important for ensuring test coverage. // This is important for ensuring test coverage.
// We don't technically need it now, but our test // We don't technically need it now, but our test
// coverage is subject to the whims of how JS sorts. // coverage is subject to the whims of how JS sorts.
const all_obj = ct.broadcast_mentions()[0];
assert.equal(th.compare_people_for_relevance(all_obj, all_obj), 0); assert.equal(th.compare_people_for_relevance(all_obj, all_obj), 0);
assert.equal(th.compare_people_for_relevance(all_obj, zman), -1); assert.equal(th.compare_people_for_relevance(all_obj, zman), -1);
assert.equal(th.compare_people_for_relevance(zman, all_obj), 1); assert.equal(th.compare_people_for_relevance(zman, all_obj), 1);
}); });