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', user: 'foobar',
post: { post: {
text: "content warning", text: 'content warning',
spoiler: 'CW' spoiler: 'CW'
} }
}, },

View File

@ -15,7 +15,7 @@ global.File = FileApi.File
global.FormData = FileApi.FormData global.FormData = FileApi.FormData
global.fetch = fetch global.fetch = fetch
async function submitMedia(accessToken, filename, alt) { async function submitMedia (accessToken, filename, alt) {
let form = new FormData() let form = new FormData()
form.append('file', fs.createReadStream(path.join(__dirname, '../tests/images/' + filename))) form.append('file', fs.createReadStream(path.join(__dirname, '../tests/images/' + filename)))
form.append('description', alt) form.append('description', alt)

View File

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

View File

@ -1,12 +1,12 @@
import { postWithTimeout } from '../_utils/ajax' import { postWithTimeout } from '../_utils/ajax'
import { auth, basename } from './utils' 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` let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/follow`
return postWithTimeout(url, null, auth(accessToken)) 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` let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/unfollow`
return postWithTimeout(url, null, auth(accessToken)) return postWithTimeout(url, null, auth(accessToken))
} }

View File

@ -1,8 +1,7 @@
import { favoriteStatus } from '../routes/_api/favorite' import { favoriteStatus } from '../routes/_api/favorite'
import fetch from 'node-fetch' import fetch from 'node-fetch'
global.fetch = fetch
import { users } from './users' import { users } from './users'
global.fetch = fetch
export async function favoriteStatusAsAdmin (statusId) { export async function favoriteStatusAsAdmin (statusId) {
return favoriteStatus('localhost:3000', users.admin.accessToken, 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(getFavoritesCount()).eql(2)
.expect($('.icon-button[aria-label="Favorite"]').getAttribute('aria-pressed')).eql('true') .expect($('.icon-button[aria-label="Favorite"]').getAttribute('aria-pressed')).eql('true')
.click($('.status-favs-reblogs').nth(1)) .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-name').nth(0).innerText).eql('foobar')
.expect($('.search-result-account-username').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') .expect($('.search-result-account-name').nth(1).innerText).eql('admin')
@ -26,7 +26,7 @@ test('shows boosts', async t => {
.expect(getReblogsCount()).eql(1) .expect(getReblogsCount()).eql(1)
.expect($('.icon-button[aria-label="Boost"]').getAttribute('aria-pressed')).eql('false') .expect($('.icon-button[aria-label="Boost"]').getAttribute('aria-pressed')).eql('false')
.click($('.status-favs-reblogs').nth(0)) .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-name').nth(0).innerText).eql('admin')
.expect($('.search-result-account-username').nth(0).innerText).eql('@admin') .expect($('.search-result-account-username').nth(0).innerText).eql('@admin')
}) })