1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Add tests for thumbnails

This commit is contained in:
Chocobozzz 2016-05-10 21:55:59 +02:00
parent cbe2f7c348
commit 9e5f374090
9 changed files with 85 additions and 15 deletions

View file

@ -76,14 +76,19 @@ describe('Test a single pod', function () {
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
video_id = video.id
utils.testImage(server.url, 'video_short.webm', video.thumbnail_path, 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('')
video_id = video.id
done()
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()
})
})
})
})
@ -103,12 +108,17 @@ describe('Test a single pod', function () {
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.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('')
utils.testImage(server.url, 'video_short.webm', video.thumbnail_path, function (err, test) {
if (err) throw err
expect(test).to.equal(true)
done()
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()
})
})
})
})
@ -127,7 +137,12 @@ describe('Test a single pod', function () {
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
done()
utils.testImage(server.url, 'video_short.webm', video.thumbnail_path, function (err, test) {
if (err) throw err
expect(test).to.equal(true)
done()
})
})
})
@ -197,6 +212,24 @@ describe('Test a single pod', function () {
})
})
it('Should have the correct thumbnails', function (done) {
utils.getVideosList(server.url, function (err, res) {
const videos = res.body
async.each(videos, function (video, callback_each) {
if (err) throw err
const video_name = video.name.replace(' name', '')
utils.testImage(server.url, video_name, video.thumbnail_path, function (err, test) {
if (err) throw err
expect(test).to.equal(true)
callback_each()
})
}, done)
})
})
after(function (done) {
process.kill(-server.app.pid)
process.kill(-webtorrent.app.pid)