From 433d42e723f3662589f5855dc3657c0e059e6197 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 16 Mar 2021 11:12:25 +0000 Subject: [PATCH] node tests: Add whiny_get() helper. --- frontend_tests/node_tests/compose_actions.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.js index f42f76273b..f7f66b4b45 100644 --- a/frontend_tests/node_tests/compose_actions.js +++ b/frontend_tests/node_tests/compose_actions.js @@ -2,7 +2,7 @@ const {strict: assert} = require("assert"); -const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace"); +const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); @@ -371,12 +371,14 @@ test("quote_and_reply", (override) => { raw_content: "Testing.", }; - channel.get = () => { + function whiny_get() { assert.fail("channel.get should not be used if raw_content is present"); - }; + } replaced = false; - quote_and_reply(opts); + with_field(channel, "get", whiny_get, () => { + quote_and_reply(opts); + }); assert(replaced); selected_message = {