From a5ff0f0c08e31782178b99b6ae352f4f3fbc9e51 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 19 May 2020 10:41:35 +1000 Subject: [PATCH] test: no need to stub fileserver. start it locally --- integration_test/common.js | 8 ++++++++ js/modules/loki_file_server_api.js | 9 ++------- preload.js | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/integration_test/common.js b/integration_test/common.js index 985cc836f..6d930cd8c 100644 --- a/integration_test/common.js +++ b/integration_test/common.js @@ -562,12 +562,20 @@ module.exports = { } response.end(); }); + this.startLocalFileServer(); this.stubSnode.listen(STUB_SNODE_SERVER_PORT); } else { this.messages = {}; } }, + async startLocalFileServer() { + if (!this.fileServer) { + // eslint-disable-next-line global-require + this.fileServer = require('../loki-file-server/app'); + } + }, + async joinOpenGroup(app, openGroupUrl, name) { await app.client.element(ConversationPage.globeButtonSection).click(); await app.client.element(ConversationPage.joinOpenGroupButton).click(); diff --git a/js/modules/loki_file_server_api.js b/js/modules/loki_file_server_api.js index 13ca54800..7fa64d74a 100644 --- a/js/modules/loki_file_server_api.js +++ b/js/modules/loki_file_server_api.js @@ -58,13 +58,8 @@ class LokiFileServerInstance { // LokiAppDotNetAPI (base) should not know about LokiFileServer. async establishConnection(serverUrl, options) { // why don't we extend this? - if (process.env.USE_STUBBED_NETWORK) { - // eslint-disable-next-line global-require - const StubAppDotNetAPI = require('../../integration_test/stubs/stub_app_dot_net_api.js'); - this._server = new StubAppDotNetAPI(this.ourKey, serverUrl); - } else { - this._server = new LokiAppDotNetAPI(this.ourKey, serverUrl); - } + + this._server = new LokiAppDotNetAPI(this.ourKey, serverUrl); // configure proxy this._server.pubKey = this.pubKey; diff --git a/preload.js b/preload.js index 4d722f1b2..f6367c8ab 100644 --- a/preload.js +++ b/preload.js @@ -56,6 +56,8 @@ if ( process.env.NODE_ENV.includes('test-integration') ) { window.electronRequire = require; + // during test-integration, file server is started on localhost + window.getDefaultFileServer = () => 'http://127.0.0.1:7070'; } window.isBeforeVersion = (toCheck, baseVersion) => {