import { VideoDetails } from '../../../../shared'
function getVideoUrl (id: string) {
- return window.location.origin + '/api/v1/videos/' + videoId
+ return window.location.origin + '/api/v1/videos/' + id
}
async function loadVideoInfo (videoId: string): Promise<VideoDetails> {
const res = await getMyUserInformation(servers[0].url, servers[0].accessToken)
user = res.body
- const test = await testImage(servers[0].url, 'avatar2-resized', user.account.avatar.path, '.png')
- expect(test).to.equal(true)
+ await testImage(servers[0].url, 'avatar2-resized', user.account.avatar.path, '.png')
await wait(5000)
})
expect(rootServer1Get.name).to.equal('root')
expect(rootServer1Get.host).to.equal('localhost:9001')
- const test = await testImage(server.url, 'avatar2-resized', rootServer1Get.avatar.path, '.png')
- expect(test).to.equal(true)
+ await testImage(server.url, 'avatar2-resized', rootServer1Get.avatar.path, '.png')
}
})
const res = await getMyUserInformation(server.url, accessTokenUser)
const user = res.body
- const test = await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png')
- expect(test).to.equal(true)
+ await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png')
})
it('Should be able to update another user', async function () {
const res = await getVideo(server.url, videoUUID)
const video = res.body
- const test = await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
- expect(test).to.equal(true)
+ await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
}
})
})
for (const video of videos) {
const videoName = video.name.replace(' name', '')
- const test = await testImage(server.url, videoName, video.thumbnailPath)
-
- expect(test).to.equal(true)
+ await testImage(server.url, videoName, video.thumbnailPath)
}
})
expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:9001')
- const test = await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png')
- expect(test).to.equal(true)
+ await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png')
expect(comment.totalReplies).to.equal(0)
expect(dateIsValid(comment.createdAt as string)).to.be.true
/* tslint:disable:no-unused-expression */
+import * as chai from 'chai'
import { isAbsolute, join } from 'path'
import * as request from 'supertest'
import * as WebTorrent from 'webtorrent'
import { readFileBufferPromise } from '../../../helpers/core-utils'
+const expect = chai.expect
let webtorrent = new WebTorrent()
function immutableAssign <T, U> (target: T, source: U) {
const minLength = body.length - ((20 * body.length) / 100)
const maxLength = body.length + ((20 * body.length) / 100)
- return data.length > minLength && data.length < maxLength
+ expect(data.length).to.be.above(minLength)
+ expect(data.length).to.be.below(maxLength)
} else {
console.log('Do not test images. Enable it by setting NODE_TEST_IMAGE env variable.')
return true
expect(file.size).to.be.above(minSize).and.below(maxSize)
{
- const test = await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath)
- expect(test).to.equal(true)
+ await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath)
}
if (attributes.previewfile) {
- const test = await testImage(url, attributes.previewfile, videoDetails.previewPath)
- expect(test).to.equal(true)
+ await testImage(url, attributes.previewfile, videoDetails.previewPath)
}
const torrent = await webtorrentAdd(magnetUri, true)