From 03073ac8466011e13daf14c642cb1149ee0f9284 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 18 Feb 2018 15:30:42 -0800 Subject: [PATCH] fix lint --- bin/run-mastodon.js | 8 +++---- bin/wait-for-mastodon-to-start.js | 4 ++-- cypress/integration/01-basic-spec.js | 23 +++++++++---------- cypress/integration/02-login-spec.js | 15 ++++++------ cypress/integration/03-basic-timeline-spec.js | 9 ++++---- cypress/support/commands.js | 2 +- package.json | 12 ++++++++-- 7 files changed, 39 insertions(+), 34 deletions(-) diff --git a/bin/run-mastodon.js b/bin/run-mastodon.js index e468c6e6..499ac174 100644 --- a/bin/run-mastodon.js +++ b/bin/run-mastodon.js @@ -19,7 +19,7 @@ const mastodonDir = path.join(dir, '../mastodon') let childProc -async function cloneMastodon() { +async function cloneMastodon () { try { await stat(mastodonDir) } catch (e) { @@ -30,7 +30,7 @@ async function cloneMastodon() { } } -async function restoreMastodonData() { +async function restoreMastodonData () { console.log('Restoring mastodon data...') try { await exec('dropdb mastodon_development', {cwd: mastodonDir}) @@ -46,7 +46,7 @@ async function restoreMastodonData() { await exec(`tar -xzf "${tgzFile}"`, {cwd: systemDir}) } -async function runMastodon() { +async function runMastodon () { console.log('Running mastodon...') let cmds = [ 'gem install bundler', @@ -71,7 +71,7 @@ async function runMastodon() { await waitForMastodonToStart() } -async function main() { +async function main () { await cloneMastodon() await restoreMastodonData() await runMastodon() diff --git a/bin/wait-for-mastodon-to-start.js b/bin/wait-for-mastodon-to-start.js index 8e6b0fd6..7579a7e1 100644 --- a/bin/wait-for-mastodon-to-start.js +++ b/bin/wait-for-mastodon-to-start.js @@ -1,6 +1,6 @@ const fetch = require('node-fetch') -async function waitForMastodonToStart() { +async function waitForMastodonToStart () { while (true) { try { let json = await ((await fetch('http://127.0.0.1:3000/api/v1/instance')).json()) @@ -22,4 +22,4 @@ if (require.main === module) { console.error(err) process.exit(1) }) -} \ No newline at end of file +} diff --git a/cypress/integration/01-basic-spec.js b/cypress/integration/01-basic-spec.js index 6fc8aef9..011b7308 100644 --- a/cypress/integration/01-basic-spec.js +++ b/cypress/integration/01-basic-spec.js @@ -1,11 +1,11 @@ describe('Basic spec', () => { - beforeEach(() => { - cy.visit('/') - }) + beforeEach(() => { + cy.visit('/') + }) - it('has the correct

', () => { - cy.contains('h1', 'Pinafore') - }) + it('has the correct

', () => { + cy.contains('h1', 'Pinafore') + }) it('navigates to about', () => { cy.get('nav a').contains('Settings').click() @@ -15,10 +15,10 @@ describe('Basic spec', () => { cy.contains('h1', 'About Pinafore') }) - it('navigates to /settings/instances/add', () => { - cy.contains('log in to an instance').click() - cy.url().should('contain', '/settings/instances/add') - }) + it('navigates to /settings/instances/add', () => { + cy.contains('log in to an instance').click() + cy.url().should('contain', '/settings/instances/add') + }) it('navigates to settings/instances', () => { cy.get('nav a').contains('Settings').click() @@ -27,5 +27,4 @@ describe('Basic spec', () => { cy.url().should('contain', '/settings/instances') cy.contains("You're not logged in to any instances") }) - -}) \ No newline at end of file +}) diff --git a/cypress/integration/02-login-spec.js b/cypress/integration/02-login-spec.js index 0685dfc9..3cc9c101 100644 --- a/cypress/integration/02-login-spec.js +++ b/cypress/integration/02-login-spec.js @@ -1,10 +1,10 @@ describe('Login spec', () => { - beforeEach(() => { - cy.visit('/') - }) + beforeEach(() => { + cy.visit('/') + }) - it('Cannot log in to a fake instance', () => { - cy.get('a').contains('log in to an instance').click() + it('Cannot log in to a fake instance', () => { + cy.get('a').contains('log in to an instance').click() cy.get('#instanceInput').clear().type('fake.nolanlawson.com') cy.get('.add-new-instance').submit() @@ -13,7 +13,7 @@ describe('Login spec', () => { cy.get('.form-error').should('not.exist') cy.get('#instanceInput').clear().type('fake.nolanlawson.com') cy.get('.form-error').should('exist') - }) + }) it('Logs in to localhost:3000', () => { cy.login('foobar@localhost:3000', 'foobarfoobar') @@ -33,5 +33,4 @@ describe('Login spec', () => { cy.url().should('contain', '/settings/instances') cy.contains("You're not logged in to any instances") }) - -}) \ No newline at end of file +}) diff --git a/cypress/integration/03-basic-timeline-spec.js b/cypress/integration/03-basic-timeline-spec.js index 2ac8ebad..6b8ffca7 100644 --- a/cypress/integration/03-basic-timeline-spec.js +++ b/cypress/integration/03-basic-timeline-spec.js @@ -25,9 +25,9 @@ describe('Basic timeline spec', () => { cy.getNthVirtualArticle(10).get('.status-content p').should('contain', "here's a secret kitten") cy.getNthVirtualArticle(11).get('.status-content p').should('contain', "here's a kitten") cy.getNthVirtualArticle(11).scrollIntoView() - cy.getNthVirtualArticle(12).get('.status-content p').should('contain', "hello admin") - cy.getNthVirtualArticle(13).get('.status-content p').should('contain', "hello foobar") - cy.getNthVirtualArticle(14).get('.status-content p').should('contain', "hello world") + cy.getNthVirtualArticle(12).get('.status-content p').should('contain', 'hello admin') + cy.getNthVirtualArticle(13).get('.status-content p').should('contain', 'hello foobar') + cy.getNthVirtualArticle(14).get('.status-content p').should('contain', 'hello world') cy.getNthVirtualArticle(14).scrollIntoView() for (let i = 0; i < 30; i++) { @@ -36,6 +36,5 @@ describe('Basic timeline spec', () => { } cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-setsize', (30 + 15).toString()) - }) -}) \ No newline at end of file +}) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index f5ceb43e..b42ad5a3 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -49,4 +49,4 @@ Cypress.Commands.add('login', (email, password) => { Cypress.Commands.add('getNthVirtualArticle', (n) => { return cy.get(`.virtual-list-item[aria-hidden=false] .status-article[aria-posinset=${n}]`) -}) \ No newline at end of file +}) diff --git a/package.json b/package.json index 6d306700..5af5e151 100644 --- a/package.json +++ b/package.json @@ -91,11 +91,19 @@ "caches", "__routes__", "__shell__", - "__assets__" + "__assets__", + "cy", + "Cypress", + "expect", + "before", + "beforeEach", + "after", + "afterEach", + "describe", + "it" ], "ignore": [ "dist", - "cypress", "routes/_utils/asyncModules.js" ] }