From 46d0ce3cbf51c7a147eb826f2cabdb078bbde749 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 28 Apr 2023 02:18:19 -0400 Subject: [PATCH] Don't load example.com in `/saveSnapshot` tests --- test/tests/server_connectorTest.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test/tests/server_connectorTest.js b/test/tests/server_connectorTest.js index aeaa8204b3..833918a187 100644 --- a/test/tests/server_connectorTest.js +++ b/test/tests/server_connectorTest.js @@ -4,6 +4,7 @@ describe("Connector Server", function () { Components.utils.import("resource://zotero-unit/httpd.js"); var win, connectorServerPath, testServerPath, httpd; var testServerPort = 16213; + var snapshotHTML = "TitleBody"; before(function* () { this.timeout(20000); @@ -24,6 +25,16 @@ describe("Connector Server", function () { testServerPath = 'http://127.0.0.1:' + testServerPort; httpd = new HttpServer(); httpd.start(testServerPort); + + httpd.registerPathHandler( + "/snapshot", + { + handle: function (request, response) { + response.setStatusLine(null, 200, "OK"); + response.write(snapshotHTML); + } + } + ); }); afterEach(function* () { @@ -1409,8 +1420,8 @@ describe("Connector Server", function () { "Content-Type": "application/json" }, body: JSON.stringify({ - url: "http://example.com", - html: "TitleBody" + url: testServerPath + '/snapshot', + html: snapshotHTML }), successCodes: false } @@ -1645,7 +1656,7 @@ describe("Connector Server", function () { }, body: JSON.stringify({ sessionID, - url: "http://example.com", + url: testServerPath + '/snapshot', html: "TitleBody" }) } @@ -1817,7 +1828,7 @@ describe("Connector Server", function () { }, body: JSON.stringify({ sessionID, - url: "http://example.com", + url: testServerPath + '/snapshot', html: "TitleBody" }) }