message list: Stub with Error instead of asserting zero calls in tests.

This is a cleaner way of testing that the function
is not called, than using counters.

This code was added in 9cb41c2976.
This commit is contained in:
Abhijeet Prasad Bodas
2021-04-29 21:53:59 +05:30
committed by Tim Abbott
parent 4bd7ec7c36
commit 29bf97313a

View File

@@ -120,17 +120,16 @@ run_test("muting", () => {
// `messages_filtered_for_topic_mutes` should skip filtering
// messages if `excludes_muted_topics` is false.
let is_topic_muted_calls = 0;
with_field(
muting,
"is_topic_muted",
() => {
is_topic_muted_calls = is_topic_muted_calls + 1;
throw new Error(
"Messages should not be filtered for topic mutes if excludes_muted_topics is false.",
);
},
() => {
const res = mld.messages_filtered_for_topic_mutes(msgs);
assert.equal(is_topic_muted_calls, 0);
assert.deepEqual(res, msgs);
},
);