/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
+import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'
+import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models'
import {
- areObjectStorageTestsDisabled,
cleanupTests,
createMultipleServers,
doubleFollow,
- expectStartWith,
makeRawRequest,
ObjectStorageCommand,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
-} from '@shared/extra-utils'
-import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models'
-
-const expect = chai.expect
+} from '@shared/server-commands'
+import { expectStartWith } from '../shared'
function assertVideoProperties (video: VideoFile, resolution: number, extname: string, size?: number) {
expect(video).to.have.nested.property('resolution.id', resolution)
async function checkFiles (video: VideoDetails, objectStorage: boolean) {
for (const file of video.files) {
- if (objectStorage) expectStartWith(file.fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl())
+ if (objectStorage) expectStartWith(file.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl())
- await makeRawRequest(file.fileUrl, HttpStatusCode.OK_200)
+ await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 })
}
}
this.timeout(90000)
const config = objectStorage
- ? ObjectStorageCommand.getDefaultConfig()
+ ? ObjectStorageCommand.getDefaultMockConfig()
: {}
// Run server 2 to have transcoding enabled
await doubleFollow(servers[0], servers[1])
- if (objectStorage) await ObjectStorageCommand.prepareDefaultBuckets()
+ if (objectStorage) await ObjectStorageCommand.prepareDefaultMockBuckets()
// Upload two videos for our needs
{
})
it('Should run a import job on video 1 with a lower resolution', async function () {
- const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i server/tests/fixtures/video_short-480.webm`
+ const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i server/tests/fixtures/video_short_480.webm`
await servers[0].cli.execWithEnv(command)
await waitJobs(servers)
})
describe('On object storage', function () {
- if (areObjectStorageTestsDisabled()) return
+ if (areMockObjectStorageTestsDisabled()) return
runTests(true)
})