From 01f5cfd481d48a4056035ef3acdd4a3bc467f97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 17 Dec 2018 21:45:29 +0100 Subject: [PATCH] Run `yarn run lint --fix` --- cypress/integration/common/steps.js | 56 ++++++++++++++++++----------- store/auth.js | 2 +- store/auth.test.js | 3 +- 3 files changed, 39 insertions(+), 22 deletions(-) diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index f6bb9f2b0..e05d6aaeb 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -30,11 +30,11 @@ Given('we have a selection of tags and categories as well as posts', () => { // TODO: use db factories instead of seed data }) -Given('my account has the following details:', (table) => { +Given('my account has the following details:', table => { // TODO: use db factories instead of seed data }) -Given('my user account has the role {string}', (role) => { +Given('my user account has the role {string}', role => { // TODO: use db factories instead of seed data }) @@ -82,31 +82,47 @@ Then('I am still logged in', () => { When('I navigate to the administration dashboard', () => { cy.get('.avatar-menu').click() - cy.get('a').contains('Systemverwaltung').click() + cy.get('a') + .contains('Systemverwaltung') + .click() }) -When(`I click on {string}`, (linkOrButton) => { +When(`I click on {string}`, linkOrButton => { cy.contains(linkOrButton).click() }) -Then('I can see a list of categories ordered by post count:', (table) => { +Then('I can see a list of categories ordered by post count:', table => { // TODO: match the table in the feature with the html table - cy.get('thead').find('tr th').should('have.length', 3) - const last_column = cy.get('tbody').find('tr td:last-child').then((last_column) => { - cy.wrap(last_column) - const values = last_column.map((i, td) => parseInt(td.textContent)).toArray() - const ordered_descending = values.slice(0).sort((a,b) => b - a) - return cy.wrap(values).should('deep.eq', ordered_descending) - }) + cy.get('thead') + .find('tr th') + .should('have.length', 3) + const last_column = cy + .get('tbody') + .find('tr td:last-child') + .then(last_column => { + cy.wrap(last_column) + const values = last_column + .map((i, td) => parseInt(td.textContent)) + .toArray() + const ordered_descending = values.slice(0).sort((a, b) => b - a) + return cy.wrap(values).should('deep.eq', ordered_descending) + }) }) -Then('I can see a list of tags ordered by user and post count:', (table) => { +Then('I can see a list of tags ordered by user and post count:', table => { // TODO: match the table in the feature with the html table - cy.get('thead').find('tr th').should('have.length', 4) - const last_column = cy.get('tbody').find('tr td:last-child').then((last_column) => { - cy.wrap(last_column) - const values = last_column.map((i, td) => parseInt(td.textContent)).toArray() - const ordered_descending = values.slice(0).sort((a,b) => b - a) - return cy.wrap(values).should('deep.eq', ordered_descending) - }) + cy.get('thead') + .find('tr th') + .should('have.length', 4) + const last_column = cy + .get('tbody') + .find('tr td:last-child') + .then(last_column => { + cy.wrap(last_column) + const values = last_column + .map((i, td) => parseInt(td.textContent)) + .toArray() + const ordered_descending = values.slice(0).sort((a, b) => b - a) + return cy.wrap(values).should('deep.eq', ordered_descending) + }) }) diff --git a/store/auth.js b/store/auth.js index 7a8a658c9..6e8435c41 100644 --- a/store/auth.js +++ b/store/auth.js @@ -27,7 +27,7 @@ export const mutations = { } export const getters = { - isAuthenticated(state){ + isAuthenticated(state) { return !!state.token }, isLoggedIn(state) { diff --git a/store/auth.test.js b/store/auth.test.js index f506d6d6e..9f53701bf 100644 --- a/store/auth.test.js +++ b/store/auth.test.js @@ -6,7 +6,8 @@ describe('isAuthenticated', () => { describe('given JWT Bearer token', () => { test('true', () => { state = { - token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InUxIiwic2x1ZyI6InBldGVyLWx1c3RpZyIsIm5hbWUiOiJQZXRlciBMdXN0aWciLCJhdmF0YXIiOiJodHRwczovL3MzLmFtYXpvbmF3cy5jb20vdWlmYWNlcy9mYWNlcy90d2l0dGVyL25haXRhbmFtb3Jlbm8vMTI4LmpwZyIsImVtYWlsIjoiYWRtaW5AZXhhbXBsZS5vcmciLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE1NDUwNjMzODcsImV4cCI6MTYzMTQ2MzM4NywiYXVkIjoiaHR0cHM6Ly9uaXRyby1zdGFnaW5nLmh1bWFuLWNvbm5lY3Rpb24ub3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