Better tests for a better world
This commit is contained in:
parent
17c912d9b1
commit
6d8ada5f24
3 changed files with 42 additions and 13 deletions
|
@ -96,6 +96,12 @@ describe('Test multiple pods', function () {
|
||||||
expect(video.podUrl).to.equal('http://localhost:9001')
|
expect(video.podUrl).to.equal('http://localhost:9001')
|
||||||
expect(video.magnetUri).to.exist
|
expect(video.magnetUri).to.exist
|
||||||
|
|
||||||
|
if (server.url !== 'http://localhost:9001') {
|
||||||
|
expect(video.isLocal).to.be.false
|
||||||
|
} else {
|
||||||
|
expect(video.isLocal).to.be.true
|
||||||
|
}
|
||||||
|
|
||||||
// All pods should have the same magnet Uri
|
// All pods should have the same magnet Uri
|
||||||
if (base_magnet === null) {
|
if (base_magnet === null) {
|
||||||
base_magnet = video.magnetUri
|
base_magnet = video.magnetUri
|
||||||
|
@ -139,6 +145,12 @@ describe('Test multiple pods', function () {
|
||||||
expect(video.podUrl).to.equal('http://localhost:9002')
|
expect(video.podUrl).to.equal('http://localhost:9002')
|
||||||
expect(video.magnetUri).to.exist
|
expect(video.magnetUri).to.exist
|
||||||
|
|
||||||
|
if (server.url !== 'http://localhost:9002') {
|
||||||
|
expect(video.isLocal).to.be.false
|
||||||
|
} else {
|
||||||
|
expect(video.isLocal).to.be.true
|
||||||
|
}
|
||||||
|
|
||||||
// All pods should have the same magnet Uri
|
// All pods should have the same magnet Uri
|
||||||
if (base_magnet === null) {
|
if (base_magnet === null) {
|
||||||
base_magnet = video.magnetUri
|
base_magnet = video.magnetUri
|
||||||
|
@ -178,23 +190,31 @@ describe('Test multiple pods', function () {
|
||||||
const videos = res.body
|
const videos = res.body
|
||||||
expect(videos).to.be.an('array')
|
expect(videos).to.be.an('array')
|
||||||
expect(videos.length).to.equal(4)
|
expect(videos.length).to.equal(4)
|
||||||
let video = videos[2]
|
const video1 = videos[2]
|
||||||
expect(video.name).to.equal('my super name for pod 3')
|
expect(video1.name).to.equal('my super name for pod 3')
|
||||||
expect(video.description).to.equal('my super description for pod 3')
|
expect(video1.description).to.equal('my super description for pod 3')
|
||||||
expect(video.podUrl).to.equal('http://localhost:9003')
|
expect(video1.podUrl).to.equal('http://localhost:9003')
|
||||||
expect(video.magnetUri).to.exist
|
expect(video1.magnetUri).to.exist
|
||||||
|
|
||||||
video = videos[3]
|
const video2 = videos[3]
|
||||||
expect(video.name).to.equal('my super name for pod 3-2')
|
expect(video2.name).to.equal('my super name for pod 3-2')
|
||||||
expect(video.description).to.equal('my super description for pod 3-2')
|
expect(video2.description).to.equal('my super description for pod 3-2')
|
||||||
expect(video.podUrl).to.equal('http://localhost:9003')
|
expect(video2.podUrl).to.equal('http://localhost:9003')
|
||||||
expect(video.magnetUri).to.exist
|
expect(video2.magnetUri).to.exist
|
||||||
|
|
||||||
|
if (server.url !== 'http://localhost:9003') {
|
||||||
|
expect(video1.isLocal).to.be.false
|
||||||
|
expect(video2.isLocal).to.be.false
|
||||||
|
} else {
|
||||||
|
expect(video1.isLocal).to.be.true
|
||||||
|
expect(video2.isLocal).to.be.true
|
||||||
|
}
|
||||||
|
|
||||||
// All pods should have the same magnet Uri
|
// All pods should have the same magnet Uri
|
||||||
if (base_magnet === null) {
|
if (base_magnet === null) {
|
||||||
base_magnet = video.magnetUri
|
base_magnet = video2.magnetUri
|
||||||
} else {
|
} else {
|
||||||
expect(video.magnetUri).to.equal.magnetUri
|
expect(video2.magnetUri).to.equal.magnetUri
|
||||||
}
|
}
|
||||||
|
|
||||||
callback()
|
callback()
|
||||||
|
|
|
@ -72,6 +72,8 @@ describe('Test a single pod', function () {
|
||||||
expect(video.description).to.equal('my super description')
|
expect(video.description).to.equal('my super description')
|
||||||
expect(video.podUrl).to.equal('http://localhost:9001')
|
expect(video.podUrl).to.equal('http://localhost:9001')
|
||||||
expect(video.magnetUri).to.exist
|
expect(video.magnetUri).to.exist
|
||||||
|
expect(video.author).to.equal('root')
|
||||||
|
expect(video.isLocal).to.be.true
|
||||||
|
|
||||||
video_id = video.id
|
video_id = video.id
|
||||||
|
|
||||||
|
@ -97,6 +99,8 @@ describe('Test a single pod', function () {
|
||||||
expect(video.description).to.equal('my super description')
|
expect(video.description).to.equal('my super description')
|
||||||
expect(video.podUrl).to.equal('http://localhost:9001')
|
expect(video.podUrl).to.equal('http://localhost:9001')
|
||||||
expect(video.magnetUri).to.exist
|
expect(video.magnetUri).to.exist
|
||||||
|
expect(video.author).to.equal('root')
|
||||||
|
expect(video.isLocal).to.be.true
|
||||||
|
|
||||||
webtorrent.add(video.magnetUri, function (torrent) {
|
webtorrent.add(video.magnetUri, function (torrent) {
|
||||||
expect(torrent.files).to.exist
|
expect(torrent.files).to.exist
|
||||||
|
@ -119,6 +123,8 @@ describe('Test a single pod', function () {
|
||||||
expect(video.name).to.equal('my super name')
|
expect(video.name).to.equal('my super name')
|
||||||
expect(video.description).to.equal('my super description')
|
expect(video.description).to.equal('my super description')
|
||||||
expect(video.podUrl).to.equal('http://localhost:9001')
|
expect(video.podUrl).to.equal('http://localhost:9001')
|
||||||
|
expect(video.author).to.equal('root')
|
||||||
|
expect(video.isLocal).to.be.true
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
|
@ -98,7 +98,10 @@ describe('Test users', function () {
|
||||||
utils.getVideosList(server.url, function (err, res) {
|
utils.getVideosList(server.url, function (err, res) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
|
|
||||||
video_id = res.body[0].id
|
const video = res.body[0]
|
||||||
|
expect(video.author).to.equal('root')
|
||||||
|
|
||||||
|
video_id = video.id
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue