expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
+ expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true
videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
if (err) throw err
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
+ expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true
videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
if (err) throw err
})
})
+ it('Should have the views updated', function (done) {
+ videosUtils.getVideo(server.url, videoId, function (err, res) {
+ if (err) throw err
+
+ const video = res.body
+ expect(video.views).to.equal(1)
+
+ done()
+ })
+ })
+
it('Should search the video by name by default', function (done) {
videosUtils.searchVideo(server.url, 'my', function (err, res) {
if (err) throw err
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
+ expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true
videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
if (err) throw err
// expect(video.isLocal).to.be.true
// expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
// expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
+ // expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true
// videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
// if (err) throw err
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
+ expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true
videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
if (err) throw err
videosUtils.removeVideo(server.url, server.accessToken, videoId, function (err) {
if (err) throw err
- fs.readdir(pathUtils.join(__dirname, '../../../test1/videos/'), function (err, files) {
+ fs.readdir(pathUtils.join(__dirname, '..', '..', '..', 'test1/videos/'), function (err, files) {
if (err) throw err
expect(files.length).to.equal(0)
- fs.readdir(pathUtils.join(__dirname, '../../../test1/thumbnails/'), function (err, files) {
+ fs.readdir(pathUtils.join(__dirname, '..', '..', '..', 'test1/thumbnails/'), function (err, files) {
if (err) throw err
expect(files.length).to.equal(0)
})
it('Should list only the two first videos', function (done) {
- videosUtils.getVideosListPagination(server.url, 0, 2, function (err, res) {
+ videosUtils.getVideosListPagination(server.url, 0, 2, 'name', function (err, res) {
if (err) throw err
const videos = res.body.data
expect(res.body.total).to.equal(6)
expect(videos.length).to.equal(2)
- expect(videos[0].name === videosListBase[0].name)
- expect(videos[1].name === videosListBase[1].name)
+ expect(videos[0].name).to.equal(videosListBase[0].name)
+ expect(videos[1].name).to.equal(videosListBase[1].name)
done()
})
})
it('Should list only the next three videos', function (done) {
- videosUtils.getVideosListPagination(server.url, 2, 3, function (err, res) {
+ videosUtils.getVideosListPagination(server.url, 2, 3, 'name', function (err, res) {
if (err) throw err
const videos = res.body.data
expect(res.body.total).to.equal(6)
expect(videos.length).to.equal(3)
- expect(videos[0].name === videosListBase[2].name)
- expect(videos[1].name === videosListBase[3].name)
- expect(videos[2].name === videosListBase[4].name)
+ expect(videos[0].name).to.equal(videosListBase[2].name)
+ expect(videos[1].name).to.equal(videosListBase[3].name)
+ expect(videos[2].name).to.equal(videosListBase[4].name)
done()
})
})
it('Should list the last video', function (done) {
- videosUtils.getVideosListPagination(server.url, 5, 6, function (err, res) {
+ videosUtils.getVideosListPagination(server.url, 5, 6, 'name', function (err, res) {
if (err) throw err
const videos = res.body.data
expect(res.body.total).to.equal(6)
expect(videos.length).to.equal(1)
- expect(videos[0].name === videosListBase[5].name)
+ expect(videos[0].name).to.equal(videosListBase[5].name)
done()
})
})
it('Should search the first video', function (done) {
- videosUtils.searchVideoWithPagination(server.url, 'webm', 'name', 0, 1, function (err, res) {
+ videosUtils.searchVideoWithPagination(server.url, 'webm', 'name', 0, 1, 'name', function (err, res) {
if (err) throw err
const videos = res.body.data
expect(res.body.total).to.equal(4)
expect(videos.length).to.equal(1)
- expect(videos[0].name === 'video_short.webm name')
+ expect(videos[0].name).to.equal('video_short1.webm name')
done()
})
})
it('Should search the last two videos', function (done) {
- videosUtils.searchVideoWithPagination(server.url, 'webm', 'name', 2, 2, function (err, res) {
+ videosUtils.searchVideoWithPagination(server.url, 'webm', 'name', 2, 2, 'name', function (err, res) {
if (err) throw err
const videos = res.body.data
expect(res.body.total).to.equal(4)
expect(videos.length).to.equal(2)
- expect(videos[0].name === 'video_short2.webm name')
- expect(videos[1].name === 'video_short3.webm name')
+ expect(videos[0].name).to.equal('video_short3.webm name')
+ expect(videos[1].name).to.equal('video_short.webm name')
done()
})
const videos = res.body.data
expect(res.body.total).to.equal(6)
expect(videos.length).to.equal(6)
- expect(videos[5].name === 'video_short.mp4 name')
- expect(videos[4].name === 'video_short.ogv name')
- expect(videos[3].name === 'video_short.webm name')
- expect(videos[2].name === 'video_short1.webm name')
- expect(videos[1].name === 'video_short2.webm name')
- expect(videos[0].name === 'video_short3.webm name')
+ expect(videos[0].name).to.equal('video_short.webm name')
+ expect(videos[1].name).to.equal('video_short.ogv name')
+ expect(videos[2].name).to.equal('video_short.mp4 name')
+ expect(videos[3].name).to.equal('video_short3.webm name')
+ expect(videos[4].name).to.equal('video_short2.webm name')
+ expect(videos[5].name).to.equal('video_short1.webm name')
done()
})
expect(res.body.total).to.equal(4)
expect(videos.length).to.equal(4)
- expect(videos[0].name === 'video_short.webm name')
- expect(videos[1].name === 'video_short1.webm name')
- expect(videos[2].name === 'video_short2.webm name')
- expect(videos[3].name === 'video_short3.webm name')
+ expect(videos[0].name).to.equal('video_short1.webm name')
+ expect(videos[1].name).to.equal('video_short2.webm name')
+ expect(videos[2].name).to.equal('video_short3.webm name')
+ expect(videos[3].name).to.equal('video_short.webm name')
- videoId = videos[3].id
+ videoId = videos[2].id
done()
})
})
it('Should have the video updated', function (done) {
+ this.timeout(60000)
+
videosUtils.getVideo(server.url, videoId, function (err, res) {
if (err) throw err
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tagup1', 'tagup2' ])
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
+ expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true
- done()
+ videosUtils.testVideoImage(server.url, 'video_short3.webm', video.thumbnailPath, function (err, test) {
+ if (err) throw err
+ expect(test).to.equal(true)
+
+ webtorrent.add(video.magnetUri, function (torrent) {
+ expect(torrent.files).to.exist
+ expect(torrent.files.length).to.equal(1)
+ expect(torrent.files[0].path).to.exist.and.to.not.equal('')
+
+ done()
+ })
+ })
})
})
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ])
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
+ expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true
done()
})
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ])
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
+ expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true
done()
})