Skip to content

Commit

Permalink
message list: Stub with Error instead of asserting zero calls in tests.
Browse files Browse the repository at this point in the history
This is a cleaner way of testing that the function
is not called, than using counters.

This code was added in 9cb41c2.
  • Loading branch information
abhijeetbodas2001 authored and timabbott committed Apr 29, 2021
1 parent 4bd7ec7 commit 29bf973
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions frontend_tests/node_tests/message_list_data.js
Expand Up @@ -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);
},
);
Expand Down

0 comments on commit 29bf973

Please sign in to comment.