From 67d3d39790fc826c87feded3f0373a336255dc16 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Wed, 13 Mar 2019 19:27:54 +0100 Subject: [PATCH] removed page preferences; closes #2259 --- .../components/common/PagePreferences.vue | 82 -------------- .../renderer/components/common/ToolBar.vue | 3 - app/src/renderer/routes.js | 6 - test/e2e/common.js | 11 +- test/e2e/preferences.js | 25 ----- .../components/common/PagePreferences.spec.js | 104 ------------------ .../PagePreferences.spec.js.snap | 34 ------ .../common/__snapshots__/ToolBar.spec.js.snap | 11 -- .../__snapshots__/PageGovernance.spec.js.snap | 22 ---- 9 files changed, 2 insertions(+), 296 deletions(-) delete mode 100644 app/src/renderer/components/common/PagePreferences.vue delete mode 100644 test/e2e/preferences.js delete mode 100644 test/unit/specs/components/common/PagePreferences.spec.js delete mode 100644 test/unit/specs/components/common/__snapshots__/PagePreferences.spec.js.snap diff --git a/app/src/renderer/components/common/PagePreferences.vue b/app/src/renderer/components/common/PagePreferences.vue deleted file mode 100644 index d0fc21c6b8..0000000000 --- a/app/src/renderer/components/common/PagePreferences.vue +++ /dev/null @@ -1,82 +0,0 @@ - - - - diff --git a/app/src/renderer/components/common/ToolBar.vue b/app/src/renderer/components/common/ToolBar.vue index c4adb1772a..b14dfbe95d 100644 --- a/app/src/renderer/components/common/ToolBar.vue +++ b/app/src/renderer/components/common/ToolBar.vue @@ -9,9 +9,6 @@ refresh - - settings - = timeout) { throw Error( `Timed out waiting for text. Expected ${text}, Showing ${(await elGetterFn().getText()) || - `nothing`}` + `nothing`}` ) } await sleep(100) @@ -85,7 +78,7 @@ module.exports = { if (Date.now() - start >= timeout) { throw Error( `Timed out waiting for value. Expected ${value}, Showing ${(await elGetterFn().getValue()) || - `nothing`}` + `nothing`}` ) } await sleep(100) diff --git a/test/e2e/preferences.js b/test/e2e/preferences.js deleted file mode 100644 index db98859672..0000000000 --- a/test/e2e/preferences.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict" - -const test = require(`tape-promise/tape`) -const { getApp, restart } = require(`./launch.js`) -const { navigateToPreferences, login } = require(`./common.js`) - -/* - * NOTE: don't use a global `let client = app.client` as the client object changes when restarting the app - */ - -test(`preferences`, async function(t) { - const { app } = await getApp(t) - const $ = (...args) => app.client.$(...args) - - await restart(app) - await login(app, `testkey`) - await navigateToPreferences(app) - - t.test(`shows preferences`, async function(t) { - t.ok(await $(`div*=Node IP`).waitForExist(), `shows Node IP`) - t.end() - }) - - t.end() -}) diff --git a/test/unit/specs/components/common/PagePreferences.spec.js b/test/unit/specs/components/common/PagePreferences.spec.js deleted file mode 100644 index ac562e1159..0000000000 --- a/test/unit/specs/components/common/PagePreferences.spec.js +++ /dev/null @@ -1,104 +0,0 @@ -import { shallowMount } from "@vue/test-utils" -import PagePreferences from "renderer/components/common/PagePreferences" - -jest.mock(`renderer/google-analytics.js`, () => () => { }) - -describe(`PagePreferences`, () => { - let wrapper, $store - - const getters = { - session: { - address: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, - errorCollection: false, - experimentalMode: false - }, - mockedConnector: false, - nodeUrl: `http://localhost:9070` - } - - beforeEach(async () => { - $store = { - commit: jest.fn(), - dispatch: jest.fn(), - getters - } - - wrapper = shallowMount(PagePreferences, { - mocks: { - $store - } - }) - }) - - it(`has the expected html structure if connected`, async () => { - expect(wrapper.vm.$el).toMatchSnapshot() - expect(wrapper.vm.$el.outerHTML).toContain(`Node IP`) - expect(wrapper.vm.$el.outerHTML).toContain(`Automatically send`) - }) - describe(`should set error collection`, () => { - it(`when the user is in production or insecure mode`, async () => { - const errorCollection = false - const dispatch = jest.fn() - PagePreferences.methods.setErrorCollection.call({ - $store: { - dispatch - }, - session: { - address: `cosmos1address`, - experimentalMode: false - } - }) - expect(dispatch).toHaveBeenCalledWith(`setErrorCollection`, { - address: `cosmos1address`, - optin: !errorCollection - }) - }) - - it(`should not update error collection when user is on experimental mode`, async () => { - const errorCollection = false - const dispatch = jest.fn() - - PagePreferences.methods.setErrorCollection.call({ - $store: { - dispatch - }, - session: { - address: `cosmos1address`, - experimentalMode: true - } - }) - expect(dispatch).not.toHaveBeenCalledWith(`setErrorCollection`, { - address: `cosmos1address`, - optin: !errorCollection - }) - }) - - it(`should set an error when user tries to set error collection on experimental mode`, async () => { - wrapper = shallowMount(PagePreferences, { - mocks: { - $store: { - dispatch: jest.fn(), - getters: { - session: { - address: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, - errorCollection: false, - experimentalMode: true - }, - mockedConnector: false, - nodeUrl: `http://localhost:9070` - } - } - } - }) - - jest.useFakeTimers() - wrapper.vm.setErrorCollection() //old style to test timers - - expect(wrapper.vm.showError).toBe(true) - expect(wrapper.vm.$el.outerHTML).toContain(`Error collection is disabled during development.`) - - jest.runAllTimers() - expect(wrapper.vm.showError).toBe(false) - }) - }) -}) diff --git a/test/unit/specs/components/common/__snapshots__/PagePreferences.spec.js.snap b/test/unit/specs/components/common/__snapshots__/PagePreferences.spec.js.snap deleted file mode 100644 index a443b4fc4e..0000000000 --- a/test/unit/specs/components/common/__snapshots__/PagePreferences.spec.js.snap +++ /dev/null @@ -1,34 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PagePreferences has the expected html structure if connected 1`] = ` - - - - - http://localhost:9070 - - - - - - - - - - -`; diff --git a/test/unit/specs/components/common/__snapshots__/ToolBar.spec.js.snap b/test/unit/specs/components/common/__snapshots__/ToolBar.spec.js.snap index 73b4c298c8..e17d236220 100644 --- a/test/unit/specs/components/common/__snapshots__/ToolBar.spec.js.snap +++ b/test/unit/specs/components/common/__snapshots__/ToolBar.spec.js.snap @@ -6,17 +6,6 @@ exports[`ToolBar has the expected html structure 1`] = ` > - - - settings - - - diff --git a/test/unit/specs/components/governance/__snapshots__/PageGovernance.spec.js.snap b/test/unit/specs/components/governance/__snapshots__/PageGovernance.spec.js.snap index 179af6b56b..071cf850e0 100644 --- a/test/unit/specs/components/governance/__snapshots__/PageGovernance.spec.js.snap +++ b/test/unit/specs/components/governance/__snapshots__/PageGovernance.spec.js.snap @@ -28,17 +28,6 @@ exports[`PageGovernance disables proposal creation if not connected 1`] = ` > - - - settings - - - @@ -150,17 +139,6 @@ exports[`PageGovernance has the expected html structure 1`] = ` > - - - settings - - -