From 459b582fb4c977a5d7516e8aa193c728fffbbe93 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Sun, 24 Feb 2019 17:14:06 +0100 Subject: [PATCH] Fixed some linting issues --- components/ContributionForm.vue | 4 +- cypress/integration/common/report.js | 25 +++++----- cypress/integration/common/settings.js | 2 +- cypress/integration/common/steps.js | 67 ++++++++++++++++---------- cypress/support/commands.js | 2 +- cypress/support/factories.js | 32 ++++++++---- 6 files changed, 82 insertions(+), 50 deletions(-) diff --git a/components/ContributionForm.vue b/components/ContributionForm.vue index 8e96c35fe..cf7c28ece 100644 --- a/components/ContributionForm.vue +++ b/components/ContributionForm.vue @@ -29,7 +29,7 @@ ghost @click.prevent="$router.back()" > - {{ $t('actions.cancel') }} + {{ $t('actions.cancel') }} - {{ $t('actions.save') }} + {{ $t('actions.save') }} diff --git a/cypress/integration/common/report.js b/cypress/integration/common/report.js index 4131ade78..0b0d3f253 100644 --- a/cypress/integration/common/report.js +++ b/cypress/integration/common/report.js @@ -35,7 +35,7 @@ Given('I am logged in with a {string} role', role => { }) cy.login({ email: `${role}@example.org`, - password: '1234', + password: '1234' }) }) @@ -125,16 +125,16 @@ When(/^I confirm the reporting dialog .*:$/, () => { }) Given('somebody reported the following posts:', table => { - table.hashes().forEach(({slug}, index) => { - const author = { - id: `author${index}`, - email: `author${index}@example.org`, - password: '1234' + table.hashes().forEach(({ slug }, index) => { + const author = { + id: `author${index}`, + email: `author${index}@example.org`, + password: '1234' } - const reporter = { - id: `reporter${index}`, - email: `reporter${index}@example.org`, - password: '1234' + const reporter = { + id: `reporter${index}`, + email: `reporter${index}@example.org`, + password: '1234' } cy.factory() .create('user', author) @@ -143,7 +143,10 @@ Given('somebody reported the following posts:', table => { cy.factory() .create('user', reporter) .authenticateAs(reporter) - .create('report', { description: 'I don\'t like this post', resource: { id: `p${index}`, type: 'post' } }) + .create('report', { + description: "I don't like this post", + resource: { id: `p${index}`, type: 'post' } + }) }) }) diff --git a/cypress/integration/common/settings.js b/cypress/integration/common/settings.js index 9f74a1200..3aa6022a8 100644 --- a/cypress/integration/common/settings.js +++ b/cypress/integration/common/settings.js @@ -53,7 +53,7 @@ Then('they can see the location in the info box below my avatar', () => { cy.contains(myLocation) }) -Then('the name {string} is still there', (name) => { +Then('the name {string} is still there', name => { matchNameInUserMenu(name) }) diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index dc183fa87..a0d348437 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -3,15 +3,14 @@ import { getLangByName } from '../../support/helpers' /* global cy */ -let lastPost = { -} +let lastPost = {} const loginCredentials = { email: 'peterpan@example.org', - password: '1234', + password: '1234' } const narratorParams = { - name: "Peter Pan", + name: 'Peter Pan', ...loginCredentials } @@ -20,29 +19,44 @@ Given('I am logged in', () => { }) Given('we have a selection of tags and categories as well as posts', () => { - cy.factory() + cy.factory() .authenticateAs(loginCredentials) - .create('category', { id: 'cat1', name: 'Just For Fun', slug: 'justforfun', icon: 'smile' }) - .create('category', { id: 'cat2', name: 'Happyness & Values', slug: 'happyness-values', icon: 'heart-o' }) - .create('category', { id: 'cat3', name: 'Health & Wellbeing', slug: 'health-wellbeing', icon: 'medkit' }) + .create('category', { + id: 'cat1', + name: 'Just For Fun', + slug: 'justforfun', + icon: 'smile' + }) + .create('category', { + id: 'cat2', + name: 'Happyness & Values', + slug: 'happyness-values', + icon: 'heart-o' + }) + .create('category', { + id: 'cat3', + name: 'Health & Wellbeing', + slug: 'health-wellbeing', + icon: 'medkit' + }) .create('tag', { id: 't1', name: 'Ecology' }) .create('tag', { id: 't2', name: 'Nature' }) .create('tag', { id: 't3', name: 'Democracy' }) .create('post', { id: 'p0' }) .create('post', { id: 'p1' }) .create('post', { id: 'p2' }) - .relate('post', 'Categories', { from: 'p0', to: 'cat1' }) - .relate('post', 'Categories', { from: 'p1', to: 'cat2' }) - .relate('post', 'Categories', { from: 'p2', to: 'cat3' }) - .relate('post', 'Tags', { from: 'p0', to: 't1' }) - .relate('post', 'Tags', { from: 'p0', to: 't2' }) - .relate('post', 'Tags', { from: 'p0', to: 't3' }) - .relate('post', 'Tags', { from: 'p1', to: 't1' }) - .relate('post', 'Tags', { from: 'p1', to: 't2' }) + .relate('post', 'Categories', { from: 'p0', to: 'cat1' }) + .relate('post', 'Categories', { from: 'p1', to: 'cat2' }) + .relate('post', 'Categories', { from: 'p2', to: 'cat3' }) + .relate('post', 'Tags', { from: 'p0', to: 't1' }) + .relate('post', 'Tags', { from: 'p0', to: 't2' }) + .relate('post', 'Tags', { from: 'p0', to: 't3' }) + .relate('post', 'Tags', { from: 'p1', to: 't1' }) + .relate('post', 'Tags', { from: 'p1', to: 't2' }) }) Given('we have the following user accounts:', table => { - table.hashes().forEach((params) => { + table.hashes().forEach(params => { cy.factory().create('user', params) }) }) @@ -125,7 +139,7 @@ When('I press {string}', label => { }) Given('we have the following posts in our database:', table => { - table.hashes().forEach(({Author, title, content}) => { + table.hashes().forEach(({ Author, title, content }) => { cy.factory() .create('user', { name: Author, @@ -148,9 +162,12 @@ When('I click on the avatar menu in the top right corner', () => { cy.get('.avatar-menu').click() }) -When('I click on the big plus icon in the bottom right corner to create post', () => { - cy.get('.post-add-button').click() -}) +When( + 'I click on the big plus icon in the bottom right corner to create post', + () => { + cy.get('.post-add-button').click() + } +) Given('I previously created a post', () => { cy.factory() @@ -158,24 +175,24 @@ Given('I previously created a post', () => { .create('post', lastPost) }) -When('I choose {string} as the title of the post', (title) => { +When('I choose {string} as the title of the post', title => { lastPost.title = title.replace('\n', ' ') cy.get('input[name="title"]').type(lastPost.title) }) -When('I type in the following text:', (text) => { +When('I type in the following text:', text => { lastPost.content = text.replace('\n', ' ') cy.get('.ProseMirror').type(lastPost.content) }) -Then('the post shows up on the landing page at position {int}', (index) => { +Then('the post shows up on the landing page at position {int}', index => { cy.openPage('landing') const selector = `:nth-child(${index}) > .ds-card > .ds-card-content` cy.get(selector).should('contain', lastPost.title) cy.get(selector).should('contain', lastPost.content) }) -Then('I get redirected to {string}', (route) => { +Then('I get redirected to {string}', route => { cy.location('pathname').should('contain', route) }) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index a2f52fd91..5b4c2055b 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -35,7 +35,7 @@ Cypress.Commands.add('switchLanguage', (name, force) => { } }) -Cypress.Commands.add('login', ({email, password}) => { +Cypress.Commands.add('login', ({ email, password }) => { cy.visit(`/login`) cy.get('input[name=email]') .trigger('focus') diff --git a/cypress/support/factories.js b/cypress/support/factories.js index 1c4515737..db31d5866 100644 --- a/cypress/support/factories.js +++ b/cypress/support/factories.js @@ -7,7 +7,7 @@ const neo4jDriver = getDriver({ username: Cypress.env('NEO4J_USERNAME'), password: Cypress.env('NEO4J_PASSWORD') }) -const factory = Factory({neo4jDriver}) +const factory = Factory({ neo4jDriver }) beforeEach(async () => { await factory.cleanDatabase({ neo4jDriver }) @@ -17,14 +17,26 @@ Cypress.Commands.add('factory', () => { return Factory() }) -Cypress.Commands.add('create', { prevSubject: true }, (factory, node, properties) => { - return factory.create(node, properties) -}) +Cypress.Commands.add( + 'create', + { prevSubject: true }, + (factory, node, properties) => { + return factory.create(node, properties) + } +) -Cypress.Commands.add('relate', { prevSubject: true }, (factory, node, relationship, properties) => { - return factory.relate(node, relationship, properties) -}) +Cypress.Commands.add( + 'relate', + { prevSubject: true }, + (factory, node, relationship, properties) => { + return factory.relate(node, relationship, properties) + } +) -Cypress.Commands.add('authenticateAs', { prevSubject: true }, (factory, loginCredentials) => { - return factory.authenticateAs(loginCredentials) -}) +Cypress.Commands.add( + 'authenticateAs', + { prevSubject: true }, + (factory, loginCredentials) => { + return factory.authenticateAs(loginCredentials) + } +)