+ const torrent = await webtorrentAdd(magnetUri, true)
+ expect(torrent.files).to.be.an('array')
+ expect(torrent.files.length).to.equal(1)
+ expect(torrent.files[0].path).match(/\.mp4$/)
+ }
+ })
+
+ it('Should wait for transcoding before publishing the video', async function () {
+ this.timeout(160_000)
+
+ {
+ // Upload the video, but wait transcoding
+ const attributes = {
+ name: 'waiting video',
+ fixture: 'video_short1.webm',
+ waitTranscoding: true
+ }
+ const { uuid } = await servers[1].videos.upload({ attributes })
+ const videoId = uuid
+
+ // Should be in transcode state
+ const body = await servers[1].videos.get({ id: videoId })
+ expect(body.name).to.equal('waiting video')
+ expect(body.state.id).to.equal(VideoState.TO_TRANSCODE)
+ expect(body.state.label).to.equal('To transcode')
+ expect(body.waitTranscoding).to.be.true
+
+ {
+ // Should have my video
+ const { data } = await servers[1].videos.listMyVideos()
+ const videoToFindInMine = data.find(v => v.name === attributes.name)
+ expect(videoToFindInMine).not.to.be.undefined
+ expect(videoToFindInMine.state.id).to.equal(VideoState.TO_TRANSCODE)
+ expect(videoToFindInMine.state.label).to.equal('To transcode')
+ expect(videoToFindInMine.waitTranscoding).to.be.true
+ }
+
+ {
+ // Should not list this video
+ const { data } = await servers[1].videos.list()
+ const videoToFindInList = data.find(v => v.name === attributes.name)
+ expect(videoToFindInList).to.be.undefined
+ }
+
+ // Server 1 should not have the video yet
+ await servers[0].videos.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
+ }