From b7f1e71cbba58b79e9cf3bf0ce81adf6d9f8a8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Viricel?= Date: Tue, 8 Dec 2020 18:13:41 +0100 Subject: [PATCH] Linting tests --- src/store/actions.js | 1 - tests/e2e/.eslintrc.js | 10 ++++------ tests/e2e/plugins/index.js | 10 +++++----- tests/e2e/specs/test.js | 8 ++++---- tests/e2e/support/index.js | 2 +- tests/unit/AddFruit.spec.js | 12 ++++++------ 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/store/actions.js b/src/store/actions.js index 1a6fe53..6eb6afe 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -17,7 +17,6 @@ export default { }, addFruit: async ({ commit }, fruit) => { commit("setLoading", true); - console.log("here"); await axios .post("http://localhost:3000/fruit", fruit) .then(res => commit("addFruit", res.data)) diff --git a/tests/e2e/.eslintrc.js b/tests/e2e/.eslintrc.js index 25e20e8..053c39f 100644 --- a/tests/e2e/.eslintrc.js +++ b/tests/e2e/.eslintrc.js @@ -1,12 +1,10 @@ module.exports = { - plugins: [ - 'cypress', - ], + plugins: ["cypress"], env: { mocha: true, - 'cypress/globals': true, + "cypress/globals": true }, rules: { - strict: 'off', - }, + strict: "off" + } }; diff --git a/tests/e2e/plugins/index.js b/tests/e2e/plugins/index.js index 8be9bc3..66ec1e5 100644 --- a/tests/e2e/plugins/index.js +++ b/tests/e2e/plugins/index.js @@ -17,10 +17,10 @@ module.exports = (on, config) => { return { ...config, - fixturesFolder: 'tests/e2e/fixtures', - integrationFolder: 'tests/e2e/specs', - screenshotsFolder: 'tests/e2e/screenshots', - videosFolder: 'tests/e2e/videos', - supportFile: 'tests/e2e/support/index.js', + fixturesFolder: "tests/e2e/fixtures", + integrationFolder: "tests/e2e/specs", + screenshotsFolder: "tests/e2e/screenshots", + videosFolder: "tests/e2e/videos", + supportFile: "tests/e2e/support/index.js" }; }; diff --git a/tests/e2e/specs/test.js b/tests/e2e/specs/test.js index e6c9471..1d74984 100644 --- a/tests/e2e/specs/test.js +++ b/tests/e2e/specs/test.js @@ -1,8 +1,8 @@ // https://docs.cypress.io/api/introduction/api.html -describe('My First Test', () => { - it('Visits the app root url', () => { - cy.visit('/'); - cy.contains('h1', 'Welcome to Your Vue.js App'); +describe("My First Test", () => { + it("Visits the app root url", () => { + cy.visit("/"); + cy.contains("h1", "Welcome to Your Vue.js App"); }); }); diff --git a/tests/e2e/support/index.js b/tests/e2e/support/index.js index 37a498f..d076cec 100644 --- a/tests/e2e/support/index.js +++ b/tests/e2e/support/index.js @@ -14,7 +14,7 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import './commands'; +import "./commands"; // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/tests/unit/AddFruit.spec.js b/tests/unit/AddFruit.spec.js index 8f9571d..b6d2c94 100644 --- a/tests/unit/AddFruit.spec.js +++ b/tests/unit/AddFruit.spec.js @@ -10,10 +10,10 @@ describe("Test AddFruit component.", () => { beforeEach(() => { actions = { - addFruit: jest.fn(), + addFruit: jest.fn() }; mutations = { - toggleModal: jest.fn(), + toggleModal: jest.fn() }; store = new Vuex.Store({ actions, mutations }); }); @@ -27,14 +27,14 @@ describe("Test AddFruit component.", () => { const wrapper = shallowMount(AddFruit, { store, localVue }); expect(wrapper.vm.$data.fruit).toEqual({ color: "#000000", - isFruit: true, + isFruit: true }); }); it("closes AddFruit modal on Cancel click.", () => { const wrapper = shallowMount(AddFruit, { store, - localVue, + localVue }); const cancelBtn = wrapper.find(".btn--cancel"); cancelBtn.trigger("click"); @@ -44,7 +44,7 @@ describe("Test AddFruit component.", () => { it("dispatches addFruit action on form submission.", () => { const wrapper = shallowMount(AddFruit, { store, - localVue, + localVue }); const form = wrapper.find("form"); form.trigger("submit"); @@ -54,7 +54,7 @@ describe("Test AddFruit component.", () => { it("checks that 'is-overlayed' class is added/removed to on mounted/destroy.", () => { const wrapper = shallowMount(AddFruit, { store, - localVue, + localVue }); expect(document.body.classList).toContain("is-overlayed"); wrapper.destroy();