mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
buddy_data: Fix error in test.
The test `get_conversation_participants` didn't need rewiring in the first place. The filter was not properly created - the field `channel_id` was wrongly being used instead of `stream_id`. Once the filter was fixed, the code automatically returned the expected stream_id and topic, without rewiring. This eliminated the use of override_rewire in that test. Fixes part of #32326.
This commit is contained in:
@@ -178,7 +178,7 @@ export function stream_sub(
|
||||
return stream_data.get_sub_by_id(id);
|
||||
}
|
||||
|
||||
export let topic = (current_filter: Filter | undefined = filter()): string | undefined => {
|
||||
export function topic(current_filter: Filter | undefined = filter()): string | undefined {
|
||||
if (current_filter === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -187,10 +187,6 @@ export let topic = (current_filter: Filter | undefined = filter()): string | und
|
||||
return operands[0];
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export function rewire_topic(value: typeof topic): void {
|
||||
topic = value;
|
||||
}
|
||||
|
||||
export function pm_ids_string(filter?: Filter): string | undefined {
|
||||
|
||||
@@ -424,7 +424,7 @@ test("show offline channel subscribers for small channels", ({override_rewire})
|
||||
assert.deepEqual(buddy_data.get_filtered_and_sorted_user_ids(""), [me.user_id, alice.user_id]);
|
||||
});
|
||||
|
||||
test("get_conversation_participants", ({override_rewire}) => {
|
||||
test("get_conversation_participants", () => {
|
||||
people.add_active_user(selma);
|
||||
|
||||
const rome_sub = {name: "Rome", subscribed: true, stream_id: 1001};
|
||||
@@ -432,7 +432,7 @@ test("get_conversation_participants", ({override_rewire}) => {
|
||||
peer_data.set_subscribers(rome_sub.stream_id, [selma.user_id, me.user_id]);
|
||||
|
||||
const filter = new Filter([
|
||||
{operator: "channel", operand: rome_sub.channel_id},
|
||||
{operator: "channel", operand: rome_sub.stream_id},
|
||||
{operator: "topic", operand: "Foo"},
|
||||
]);
|
||||
message_lists.set_current({
|
||||
@@ -443,8 +443,6 @@ test("get_conversation_participants", ({override_rewire}) => {
|
||||
},
|
||||
},
|
||||
});
|
||||
override_rewire(narrow_state, "stream_id", () => rome_sub.stream_id);
|
||||
override_rewire(narrow_state, "topic", () => "Foo");
|
||||
|
||||
activity_ui.rerender_user_sidebar_participants();
|
||||
assert.deepEqual(
|
||||
|
||||
Reference in New Issue
Block a user