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.

node tests: Clear page_params at start of run_test.

Steve Howell902e0f7e9518
diff --git a/frontend_tests/zjsunit/test.js b/frontend_tests/zjsunit/test.js
index 36049d18a45..65b763eb4e7 100644
--- a/frontend_tests/zjsunit/test.js
+++ b/frontend_tests/zjsunit/test.js
@@ -3,6 +3,7 @@
const namespace = require("./namespace");
const zblueslip = require("./zblueslip");
const $ = require("./zjquery");
+const zpage_params = require("./zpage_params");
let current_file_name;
let verbose = false;
@@ -25,6 +26,7 @@ exports.run_test = (label, f, opts) => {
if (!sloppy_$ && $.clear_all_elements) {
$.clear_all_elements();
}
+ zpage_params.reset();
try {
namespace.with_overrides(f);
diff --git a/frontend_tests/zjsunit/zpage_params.js b/frontend_tests/zjsunit/zpage_params.js
index eb6dea6c34f..6f05d5678be 100644
--- a/frontend_tests/zjsunit/zpage_params.js
+++ b/frontend_tests/zjsunit/zpage_params.js
@@ -1,5 +1,11 @@
"use strict";
+exports.page_params = {};
+
exports.reset = () => {
- exports.page_params = {};
+ for (const field in exports.page_params) {
+ if (Object.prototype.hasOwnProperty.call(exports.page_params, field)) {
+ delete exports.page_params[field];
+ }
+ }
};