fix lint issues

This commit is contained in:
Nolan Lawson 2018-02-19 18:25:59 -08:00
parent 391455bee4
commit 5c2dc4c421
11 changed files with 32 additions and 28 deletions

View File

@ -40,4 +40,8 @@ Lint:
Run integration tests:
npm test
npm test
Automatically fix most linting issues:
npx standard --fix

View File

@ -51,4 +51,4 @@ export const favorites = [
{content: 'notification of followers-only message'},
{content: 'notification of unlisted message'},
{content: 'pinned toot 1'}
]
]

View File

@ -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')
})
})

View File

@ -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 <h1>', 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")
})
})

View File

@ -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")
})
})

View File

@ -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)
})
})

View File

@ -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')
})
})

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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()
}
}
}
}