mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
zjsunit: Deglobalize read_fixture_data.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Steve Howell
parent
cc162a9067
commit
22166e8ea9
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user