hashchange: Add stub_with_args for admin.launch test.

We've added a new stub function that records the arguments passed
to a function called `stub_with_args`. We're only using this right
now for `admin.launch` since we plan to test that arg in the upcoming
commits for the redirect.
For most of the other functions, the args are empty, so it doesn't make
sense to refactor those tests to use this new stub.
This commit is contained in:
Shubham Padia 2024-06-12 08:48:34 +00:00 committed by Tim Abbott
parent 1204d86818
commit 9c47a7be28
1 changed files with 8 additions and 2 deletions

View File

@ -172,7 +172,13 @@ function test_helper({override, override_rewire, change_tab}) {
};
}
stub(admin, "launch");
function stub_with_args(module, func_name) {
module[func_name] = (...args) => {
events.push([module, func_name, args]);
};
}
stub_with_args(admin, "launch");
stub(admin, "build_page");
stub(drafts_overlay_ui, "launch");
stub(message_viewport, "stop_auto_scrolling");
@ -363,7 +369,7 @@ run_test("hash_interactions", ({override, override_rewire}) => {
[overlays, "close_for_hash_change"],
[settings, "build_page"],
[admin, "build_page"],
[admin, "launch"],
[admin, "launch", ["user-list-admin"]],
]);
helper.clear_events();