This commit is contained in:
Nolan Lawson 2018-03-05 23:56:48 -08:00
parent c574606f0c
commit 4a49e9118e
8 changed files with 13 additions and 14 deletions

View File

@ -74,7 +74,7 @@ export const actions = times(30, i => ({
{
user: 'foobar',
post: {
text: "content warning",
text: 'content warning',
spoiler: 'CW'
}
},
@ -259,4 +259,4 @@ export const actions = times(30, i => ({
privacy: 'unlisted'
}
}
])
])

View File

@ -15,7 +15,7 @@ global.File = FileApi.File
global.FormData = FileApi.FormData
global.fetch = fetch
async function submitMedia(accessToken, filename, alt) {
async function submitMedia (accessToken, filename, alt) {
let form = new FormData()
form.append('file', fs.createReadStream(path.join(__dirname, '../tests/images/' + filename)))
form.append('description', alt)
@ -72,4 +72,4 @@ export async function restoreMastodonData () {
await new Promise(resolve => setTimeout(resolve, 1500))
}
console.log('Restored mastodon data')
}
}

View File

@ -34,7 +34,7 @@ async function cloneMastodon () {
}
}
async function setupMastodonDatabase() {
async function setupMastodonDatabase () {
console.log('Setting up mastodon database...')
try {
await exec('dropdb mastodon_development', {cwd: mastodonDir})

View File

@ -1,12 +1,12 @@
import { postWithTimeout } from '../_utils/ajax'
import { auth, basename } from './utils'
export async function followAccount(instanceName, accessToken, accountId) {
export async function followAccount (instanceName, accessToken, accountId) {
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/follow`
return postWithTimeout(url, null, auth(accessToken))
}
export async function unfollowAccount(instanceName, accessToken, accountId) {
export async function unfollowAccount (instanceName, accessToken, accountId) {
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/unfollow`
return postWithTimeout(url, null, auth(accessToken))
}
}

View File

@ -32,4 +32,4 @@ export async function pinStatus (instanceName, accessToken, statusId) {
export async function unpinStatus (instanceName, accessToken, statusId) {
let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/unpin`
return postWithTimeout(url, null, auth(accessToken))
}
}

View File

@ -1,8 +1,7 @@
import { favoriteStatus } from '../routes/_api/favorite'
import fetch from 'node-fetch'
global.fetch = fetch
import { users } from './users'
global.fetch = fetch
export async function favoriteStatusAsAdmin (statusId) {
return favoriteStatus('localhost:3000', users.admin.accessToken, statusId)

View File

@ -12,7 +12,7 @@ test('shows favorites', async t => {
.expect(getFavoritesCount()).eql(2)
.expect($('.icon-button[aria-label="Favorite"]').getAttribute('aria-pressed')).eql('true')
.click($('.status-favs-reblogs').nth(1))
.expect(getUrl()).match(/\/statuses\/[^\/]+\/favorites/)
.expect(getUrl()).match(/\/statuses\/[^/]+\/favorites/)
.expect($('.search-result-account-name').nth(0).innerText).eql('foobar')
.expect($('.search-result-account-username').nth(0).innerText).eql('@foobar')
.expect($('.search-result-account-name').nth(1).innerText).eql('admin')
@ -26,7 +26,7 @@ test('shows boosts', async t => {
.expect(getReblogsCount()).eql(1)
.expect($('.icon-button[aria-label="Boost"]').getAttribute('aria-pressed')).eql('false')
.click($('.status-favs-reblogs').nth(0))
.expect(getUrl()).match(/\/statuses\/[^\/]+\/reblogs/)
.expect(getUrl()).match(/\/statuses\/[^/]+\/reblogs/)
.expect($('.search-result-account-name').nth(0).innerText).eql('admin')
.expect($('.search-result-account-username').nth(0).innerText).eql('@admin')
})

View File

@ -23,4 +23,4 @@ export const users = {
accessToken: 'e9a463ba1729ae0049a97a312af702cb3d08d84de1cc8d6da3fad90af068117b',
id: 4
}
}
}