hotkey: Fix warning about unused login_to_access import.

This commit is contained in:
Aman Agrawal
2025-04-28 19:31:25 +05:30
committed by Tim Abbott
parent 142d1958a0
commit 645850ccfa
2 changed files with 11 additions and 6 deletions

View File

@@ -96,9 +96,7 @@ mock_esm("../src/recent_view_ui", {
is_in_focus: () => false,
});
const spectators = mock_esm("../src/spectators", {
login_to_access() {},
});
const spectators = zrequire("../src/spectators");
message_lists.current = {
visibly_empty() {
@@ -569,11 +567,11 @@ run_test("test new user input hook called", () => {
assert.ok(hook_called);
});
run_test("e shortcut works for anonymous users", () => {
run_test("e shortcut works for anonymous users", ({override_rewire}) => {
page_params.is_spectator = true;
const stub = make_stub();
spectators.login_to_access = stub.f;
override_rewire(spectators, "login_to_access", stub.f);
const e = {
which: "e".codePointAt(0),
@@ -581,4 +579,7 @@ run_test("e shortcut works for anonymous users", () => {
process_keydown(e);
assert.equal(stub.num_calls, 0, "login_to_access should not be called for 'e' shortcut");
// Fake call to avoid warning about unused stub.
spectators.login_to_access();
assert.equal(stub.num_calls, 1);
});