Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

zjsunit: Allow multiple overrides again.

Steve Howell8ab5475b37fb
diff --git a/frontend_tests/zjsunit/namespace.js b/frontend_tests/zjsunit/namespace.js
index 4afc9dd0b73..c03f21cad21 100644
--- a/frontend_tests/zjsunit/namespace.js
+++ b/frontend_tests/zjsunit/namespace.js
@@ -157,8 +157,6 @@ exports.with_overrides = function (test_function) {
const restore_callbacks = [];
const unused_funcs = new Map();
- const funcs = new Map();
-
const override = function (obj, func_name, f) {
// Given an object `obj` (which is usually a module object),
// we re-map `obj[func_name]` to the `f` passed in by the caller.
@@ -183,22 +181,6 @@ exports.with_overrides = function (test_function) {
`);
}
- if (!funcs.has(obj)) {
- funcs.set(obj, new Map());
- }
-
- if (funcs.get(obj).has(func_name)) {
- // Prevent overriding the same function twice, so that
- // it's super easy to reason about our logic to restore
- // the original function. Usually if somebody sees this
- // error, it's a symptom of not breaking up tests enough.
- throw new Error(
- "You can only override a function one time. Use with_field for more granular control.",
- );
- }
-
- funcs.get(obj).set(func_name, true);
-
if (!unused_funcs.has(obj)) {
unused_funcs.set(obj, new Map());
}