From 5c2dc4c42105275eab2f43b1068b157db7142996 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 19 Feb 2018 18:25:59 -0800 Subject: [PATCH] fix lint issues --- README.md | 6 +++++- tests/fixtures.js | 2 +- tests/roles.js | 4 ++-- tests/spec/01-basic-spec.js | 6 +++--- tests/spec/02-login-spec.js | 10 +++++----- tests/spec/03-basic-timeline-spec.js | 8 ++++---- tests/spec/04-pinned-statuses.js | 8 ++++---- tests/spec/05-status-types.js | 4 ++-- tests/spec/06-tabindex.js | 4 ++-- tests/spec/07-account-profile.js | 4 ++-- tests/utils.js | 4 ++-- 11 files changed, 32 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 7960a6a..45f4a05 100644 --- a/README.md +++ b/README.md @@ -40,4 +40,8 @@ Lint: Run integration tests: - npm test \ No newline at end of file + npm test + +Automatically fix most linting issues: + + npx standard --fix \ No newline at end of file diff --git a/tests/fixtures.js b/tests/fixtures.js index d363fb7..68e9d16 100644 --- a/tests/fixtures.js +++ b/tests/fixtures.js @@ -51,4 +51,4 @@ export const favorites = [ {content: 'notification of followers-only message'}, {content: 'notification of unlisted message'}, {content: 'pinned toot 1'} -] \ No newline at end of file +] diff --git a/tests/roles.js b/tests/roles.js index 814d28a..d78f17e 100644 --- a/tests/roles.js +++ b/tests/roles.js @@ -1,7 +1,7 @@ import { Selector as $, Role } from 'testcafe' import { addInstanceButton, getUrl, instanceInput } from './utils' -function login(t, username, password) { +function login (t, username, password) { return t.typeText(instanceInput, 'localhost:3000') .click(addInstanceButton) .expect(getUrl()).eql('http://localhost:3000/auth/sign_in') @@ -15,4 +15,4 @@ function login(t, username, password) { export const foobarRole = Role('http://localhost:4002/settings/instances/add', async t => { await login(t, 'foobar@localhost:3000', 'foobarfoobar') -}) \ No newline at end of file +}) diff --git a/tests/spec/01-basic-spec.js b/tests/spec/01-basic-spec.js index 3c27729..da5eea4 100644 --- a/tests/spec/01-basic-spec.js +++ b/tests/spec/01-basic-spec.js @@ -1,8 +1,8 @@ import { Selector as $ } from 'testcafe' import { getUrl, settingsButton } from '../utils' -fixture `01-basic-spec.js` - .page `http://localhost:4002` +fixture`01-basic-spec.js` + .page`http://localhost:4002` test('has the correct

', async t => { await t @@ -30,4 +30,4 @@ test('navigates to settings/instances', async t => { .expect(getUrl()).contains('/settings/instances') .expect($('.container').innerText) .contains("You're not logged in to any instances") -}) \ No newline at end of file +}) diff --git a/tests/spec/02-login-spec.js b/tests/spec/02-login-spec.js index 9e21bb9..02149ba 100644 --- a/tests/spec/02-login-spec.js +++ b/tests/spec/02-login-spec.js @@ -1,12 +1,12 @@ import { Selector as $ } from 'testcafe' -import { addInstanceButton, getUrl, instanceInput, login, settingsButton } from '../utils' +import { addInstanceButton, getUrl, instanceInput, settingsButton } from '../utils' -fixture `02-login-spec.js` - .page `http://localhost:4002` +fixture`02-login-spec.js` + .page`http://localhost:4002` const formError = $('.form-error') -function manualLogin(t, username, password) { +function manualLogin (t, username, password) { return t.click($('a').withText('log in to an instance')) .expect(getUrl()).contains('/settings/instances/add') .typeText(instanceInput, 'localhost:3000') @@ -49,4 +49,4 @@ test('Logs out', async t => { .click($('#modal-dialog button').withText('OK')) .expect($('.container').innerText) .contains("You're not logged in to any instances") -}) \ No newline at end of file +}) diff --git a/tests/spec/03-basic-timeline-spec.js b/tests/spec/03-basic-timeline-spec.js index d21c631..e170200 100644 --- a/tests/spec/03-basic-timeline-spec.js +++ b/tests/spec/03-basic-timeline-spec.js @@ -1,10 +1,10 @@ import { Selector as $ } from 'testcafe' -import { getUrl, login, validateTimeline } from '../utils' +import { getUrl, validateTimeline } from '../utils' import { homeTimeline, notifications, localTimeline, favorites } from '../fixtures' import { foobarRole } from '../roles' -fixture `03-basic-timeline-spec.js` - .page `http://localhost:4002` +fixture`03-basic-timeline-spec.js` + .page`http://localhost:4002` const firstArticle = $('.virtual-list-item[aria-hidden=false] .status-article') @@ -52,4 +52,4 @@ test('Shows favorites', async t => { .expect(getUrl()).contains('/favorites') await validateTimeline(t, favorites) -}) \ No newline at end of file +}) diff --git a/tests/spec/04-pinned-statuses.js b/tests/spec/04-pinned-statuses.js index 9f36c56..ab1f42b 100644 --- a/tests/spec/04-pinned-statuses.js +++ b/tests/spec/04-pinned-statuses.js @@ -1,9 +1,9 @@ import { Selector as $ } from 'testcafe' -import { getUrl, login } from '../utils' +import { getUrl } from '../utils' import { foobarRole } from '../roles' -fixture `04-pinned-statuses.js` - .page `http://localhost:4002` +fixture`04-pinned-statuses.js` + .page`http://localhost:4002` test("shows a user's pinned statuses", async t => { await t.useRole(foobarRole) @@ -32,4 +32,4 @@ test("shows pinned statuses on a user's account page 2", async t => { .expect($('.pinned-statuses .status-article').innerText).contains('pinned toot 1') .expect($('.pinned-statuses .status-article[aria-posinset="1"]').getAttribute('aria-setsize')).eql('2') .expect($('.pinned-statuses .status-article[aria-posinset="1"]').innerText).contains('pinned toot 2') -}) \ No newline at end of file +}) diff --git a/tests/spec/05-status-types.js b/tests/spec/05-status-types.js index 5d49ea0..341631b 100644 --- a/tests/spec/05-status-types.js +++ b/tests/spec/05-status-types.js @@ -1,8 +1,8 @@ import { getNthVirtualArticle } from '../utils' import { foobarRole } from '../roles' -fixture `05-status-types.js` - .page `http://localhost:4002` +fixture`05-status-types.js` + .page`http://localhost:4002` test('shows direct vs followers-only vs regular', async t => { await t.useRole(foobarRole) diff --git a/tests/spec/06-tabindex.js b/tests/spec/06-tabindex.js index 9ca7431..dae96e5 100644 --- a/tests/spec/06-tabindex.js +++ b/tests/spec/06-tabindex.js @@ -2,8 +2,8 @@ import { Selector as $ } from 'testcafe' import { getNthVirtualArticle } from '../utils' import { foobarRole } from '../roles' -fixture `06-tabindex.js` - .page `http://localhost:4002` +fixture`06-tabindex.js` + .page`http://localhost:4002` test('shows correct tabindex in home timeline', async t => { await t.useRole(foobarRole) diff --git a/tests/spec/07-account-profile.js b/tests/spec/07-account-profile.js index dc176d0..7323095 100644 --- a/tests/spec/07-account-profile.js +++ b/tests/spec/07-account-profile.js @@ -2,8 +2,8 @@ import { Selector as $ } from 'testcafe' import { getUrl } from '../utils' import { foobarRole } from '../roles' -fixture `07-account-profile.js` - .page `http://localhost:4002` +fixture`07-account-profile.js` + .page`http://localhost:4002` test('shows account profile', async t => { await t.useRole(foobarRole) diff --git a/tests/utils.js b/tests/utils.js index 112420e..4965f8d 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -10,7 +10,7 @@ export function getNthVirtualArticle (n) { return $(`.virtual-list-item[aria-hidden="false"] article[aria-posinset="${n}"]`) } -export async function validateTimeline(t, timeline) { +export async function validateTimeline (t, timeline) { for (let i = 0; i < timeline.length; i++) { let status = timeline[i] if (status.content) { @@ -40,4 +40,4 @@ export async function validateTimeline(t, timeline) { await t.expect($('.loading-footer').exist).notOk() } } -} \ No newline at end of file +}