Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tests: Remove rewires in browser_history.test.cjs.
Tim Abbottb119a826629a
diff --git a/web/src/browser_history.ts b/web/src/browser_history.tsindex 34ec72993c9..e2005bcab4c 100644--- a/web/src/browser_history.ts+++ b/web/src/browser_history.ts@@ -58,7 +58,7 @@ export function save_old_hash(): boolean {return was_internal_change;}-export let update = (new_hash: string): void => {+export function update(new_hash: string): void {const old_hash = window.location.hash;if (!new_hash.startsWith("#")) {@@ -78,10 +78,6 @@ export let update = (new_hash: string): void => {state.old_hash = old_hash;state.is_internal_change = true;window.location.hash = new_hash;-};--export function rewire_update(value: typeof update): void {- update = value;}export function exit_overlay(): void {diff --git a/web/tests/browser_history.test.cjs b/web/tests/browser_history.test.cjsindex 58bc36f0d09..add0f2df048 100644--- a/web/tests/browser_history.test.cjs+++ b/web/tests/browser_history.test.cjs@@ -3,7 +3,6 @@const assert = require("node:assert/strict");const {zrequire} = require("./lib/namespace.cjs");-const {make_stub} = require("./lib/stub.cjs");const {run_test} = require("./lib/test.cjs");const blueslip = require("./lib/zblueslip.cjs");@@ -54,21 +53,17 @@ test("error for bad hashes", () => {browser_history.update(hash);});-test("update internal hash if required", ({override_rewire}) => {+test("update internal hash if required", () => {const hash = "#test/hash";- const stub = make_stub();- override_rewire(browser_history, "update", stub.f);browser_history.update_hash_internally_if_required(hash);- assert.equal(stub.num_calls, 1);+ assert.equal(window.location.hash, hash);- window.location.hash = "#test/hash";- // update with same hash+ // Calling again with the same hash should be a no-op.+ // If update() were called, it would log a blueslip.info+ // for the redundant hash, so verify no new info appeared.+ const info_count = blueslip.get_test_logs("info").length;browser_history.update_hash_internally_if_required(hash);- // but no update was made since the- // hash was already updated.- // Evident by no increase in number of- // calls to stub.- assert.equal(stub.num_calls, 1);+ assert.equal(blueslip.get_test_logs("info").length, info_count);});test("web-public view hash restore", () => {