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: Deglobalize read_fixture_data.

Anders Kaseorg22166e8ea900
diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js
index 66e5366600b..b04fb9a91f9 100644
--- a/frontend_tests/node_tests/markdown.js
+++ b/frontend_tests/node_tests/markdown.js
@@ -2,6 +2,7 @@
const {strict: assert} = require("assert");
+const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_cases.json");
const markdown_assert = require("../zjsunit/markdown_assert");
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -197,8 +198,6 @@ run_test("fenced_block_defaults", () => {
markdown.initialize(page_params.realm_filters, markdown_config.get_helpers());
-const markdown_data = global.read_fixture_data("markdown_test_cases.json");
-
run_test("markdown_detection", () => {
const no_markup = [
"This is a plaintext message",
@@ -246,7 +245,7 @@ run_test("markdown_detection", () => {
});
run_test("marked_shared", () => {
- const tests = markdown_data.regular_tests;
+ const tests = markdown_test_cases.regular_tests;
tests.forEach((test) => {
// Ignore tests if specified
diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js
index 94d7a674d41..5aa8184d66b 100644
--- a/frontend_tests/zjsunit/index.js
+++ b/frontend_tests/zjsunit/index.js
@@ -1,6 +1,5 @@
"use strict";
-const fs = require("fs");
const Module = require("module");
const path = require("path");
@@ -53,13 +52,6 @@ Module.prototype.hot = {
accept: noop,
};
-// Set up fixtures.
-global.read_fixture_data = (fn) => {
- const full_fn = path.join(__dirname, "../../zerver/tests/fixtures/", fn);
- const data = JSON.parse(fs.readFileSync(full_fn, "utf8", "r"));
- return data;
-};
-
function short_tb(tb) {
const lines = tb.split("\n");