Move fixtures in tests/

This commit is contained in:
Chocobozzz 2018-06-07 09:48:10 +02:00
parent 28be89161a
commit 99d103019c
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
31 changed files with 26 additions and 28 deletions

View File

@ -279,7 +279,7 @@ describe('Test users API validators', function () {
it('Should fail without an incorrect input file', async function () {
const fields = {}
const attaches = {
'avatarfile': join(__dirname, '..', 'fixtures', 'video_short.mp4')
'avatarfile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
}
await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches })
})
@ -287,7 +287,7 @@ describe('Test users API validators', function () {
it('Should fail with a big file', async function () {
const fields = {}
const attaches = {
'avatarfile': join(__dirname, '..', 'fixtures', 'avatar-big.png')
'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')
}
await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches })
})
@ -295,7 +295,7 @@ describe('Test users API validators', function () {
it('Should succeed with the correct params', async function () {
const fields = {}
const attaches = {
'avatarfile': join(__dirname, '..', 'fixtures', 'avatar.png')
'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png')
}
await makeUploadRequest({
url: server.url,

View File

@ -163,7 +163,7 @@ describe('Test videos API validator', function () {
describe('When adding a video', function () {
let baseCorrectParams
const baseCorrectAttaches = {
'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.webm')
}
before(function () {
@ -313,7 +313,7 @@ describe('Test videos API validator', function () {
it('Should fail without an incorrect input file', async function () {
const fields = baseCorrectParams
const attaches = {
'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm')
}
await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
})
@ -321,8 +321,8 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams
const attaches = {
'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar.png'),
'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'),
'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm')
}
await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@ -331,8 +331,8 @@ describe('Test videos API validator', function () {
it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams
const attaches = {
'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar-big.png'),
'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'),
'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm')
}
await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@ -341,8 +341,8 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams
const attaches = {
'previewfile': join(__dirname, '..', 'fixtures', 'avatar.png'),
'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'),
'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm')
}
await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@ -351,8 +351,8 @@ describe('Test videos API validator', function () {
it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams
const attaches = {
'previewfile': join(__dirname, '..', 'fixtures', 'avatar-big.png'),
'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'),
'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm')
}
await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@ -377,7 +377,7 @@ describe('Test videos API validator', function () {
{
const attaches = immutableAssign(baseCorrectAttaches, {
videofile: join(__dirname, '..', 'fixtures', 'video_short.mp4')
videofile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
})
await makeUploadRequest({
@ -392,7 +392,7 @@ describe('Test videos API validator', function () {
{
const attaches = immutableAssign(baseCorrectAttaches, {
videofile: join(__dirname, '..', 'fixtures', 'video_short.ogv')
videofile: join(__dirname, '..', '..', 'fixtures', 'video_short.ogv')
})
await makeUploadRequest({
@ -510,7 +510,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams
const attaches = {
'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar.png')
'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png')
}
await makeUploadRequest({
@ -526,7 +526,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams
const attaches = {
'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar-big.png')
'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')
}
await makeUploadRequest({
@ -542,7 +542,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams
const attaches = {
'previewfile': join(__dirname, '..', 'fixtures', 'avatar.png')
'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png')
}
await makeUploadRequest({
@ -558,7 +558,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams
const attaches = {
'previewfile': join(__dirname, '..', 'fixtures', 'avatar-big.png')
'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')
}
await makeUploadRequest({

View File

@ -938,7 +938,7 @@ describe('Test multiple servers', function () {
.field('channelId', '1')
.field('commentsEnabled', 'true')
const filePath = join(__dirname, '..', '..', 'api', 'fixtures', 'video_short.webm')
const filePath = join(__dirname, '..', '..', 'fixtures', 'video_short.webm')
await req.attach('videofile', filePath)
.expect(200)

View File

@ -59,7 +59,7 @@ describe('Test create import video jobs', function () {
it('Should run a import job on video 1 with a lower resolution', async function () {
const env = getEnvCli(servers[0])
await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/api/fixtures/video_short-480.webm`)
await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm`)
await wait(30000)
@ -83,7 +83,7 @@ describe('Test create import video jobs', function () {
it('Should run a import job on video 2 with the same resolution', async function () {
const env = getEnvCli(servers[1])
await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/api/fixtures/video_short.ogv`)
await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`)
await wait(30000)

View File

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -46,7 +46,7 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
const body = res.body
const data = await readFileBufferPromise(join(__dirname, '..', '..', 'api', 'fixtures', imageName + extension))
const data = await readFileBufferPromise(join(__dirname, '..', '..', 'fixtures', imageName + extension))
const minLength = body.length - ((20 * body.length) / 100)
const maxLength = body.length + ((20 * body.length) / 100)
@ -63,7 +63,7 @@ function buildAbsoluteFixturePath (path: string) {
return path
}
return join(__dirname, '..', '..', 'api', 'fixtures', path)
return join(__dirname, '..', '..', 'fixtures', path)
}
// ---------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
import * as request from 'supertest'
import { buildAbsoluteFixturePath } from '../'
import { buildAbsoluteFixturePath } from '../miscs/miscs'
function makeGetRequest (options: {
url: string,

View File

@ -164,7 +164,7 @@ function updateMyAvatar (options: {
if (isAbsolute(options.fixture)) {
filePath = options.fixture
} else {
filePath = join(__dirname, '..', '..', 'api', 'fixtures', options.fixture)
filePath = join(__dirname, '..', '..', 'fixtures', options.fixture)
}
return makeUploadRequest({

View File

@ -502,8 +502,6 @@ async function completeVideoCheck (
expect(dateIsValid(video.updatedAt)).to.be.true
if (attributes.publishedAt) {
console.log(attributes.publishedAt)
console.log(video.publishedAt)
expect(video.publishedAt).to.equal(attributes.publishedAt)
}