Fix tests

This commit is contained in:
Chocobozzz 2017-12-14 10:20:05 +01:00
parent d48ff09d27
commit 6f045b5791
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 11 additions and 13 deletions

View File

@ -3,7 +3,7 @@
</h1> </h1>
<h4 align="center"> <h4 align="center">
Decentralized video streaming platform using P2P (BitTorrent) directly in the web browser with <a href="https://github.com/feross/webtorrent">WebTorrent</a>. Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with <a href="https://github.com/feross/webtorrent">WebTorrent</a>.
</h4> </h4>
**PeerTube is sponsored by [Framasoft](https://framatube.org/#en), a non-profit that promotes, spreads and develops free-libre software. If you want to support this project, please [consider donating them](https://soutenir.framasoft.org/en/).** **PeerTube is sponsored by [Framasoft](https://framatube.org/#en), a non-profit that promotes, spreads and develops free-libre software. If you want to support this project, please [consider donating them](https://soutenir.framasoft.org/en/).**
@ -128,13 +128,12 @@ See [wiki](https://github.com/Chocobozzz/PeerTube/wiki) for complete installatio
#### Debian #### Debian
1. Install NodeJS 6.x (previous LTS): [https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions) 1. Install NodeJS 8.x (current LTS): [https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)
2. Install yarn: [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install) 2. Install yarn: [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
3. Add jessie backports to your *source.list*: http://backports.debian.org/Instructions/
4. Run: 4. Run:
$ apt-get update $ apt-get update
$ apt-get install ffmpeg postgresql-9.4 openssl $ apt-get install ffmpeg postgresql openssl
#### Ubuntu 16.04 #### Ubuntu 16.04

View File

@ -4,14 +4,14 @@ verlte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
} }
nodeMinVersion="6.0.0" nodeMinVersion="8.0.0"
npmMinVersion="3.0.0" npmMinVersion="3.0.0"
actualNodeVersion=$(node --version | tr -d "v") actualNodeVersion=$(node --version | tr -d "v")
actualNpmVersion=$(npm --version) actualNpmVersion=$(npm --version)
if verlte $actualNodeVersion $nodeMinVersion; then if verlte $actualNodeVersion $nodeMinVersion; then
echo 'You need node >= 6' echo 'You need node >= 8'
exit 0 exit 0
fi fi

View File

@ -110,7 +110,6 @@ describe('Test multiple servers', function () {
expect(video.description).to.equal('my super description for server 1') expect(video.description).to.equal('my super description for server 1')
expect(video.serverHost).to.equal('localhost:9001') expect(video.serverHost).to.equal('localhost:9001')
expect(video.duration).to.equal(10) expect(video.duration).to.equal(10)
expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
expect(dateIsValid(video.createdAt)).to.be.true expect(dateIsValid(video.createdAt)).to.be.true
expect(dateIsValid(video.updatedAt)).to.be.true expect(dateIsValid(video.updatedAt)).to.be.true
expect(video.accountName).to.equal('root') expect(video.accountName).to.equal('root')
@ -124,6 +123,7 @@ describe('Test multiple servers', function () {
expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true
expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true
expect(videoDetails.files).to.have.lengthOf(1) expect(videoDetails.files).to.have.lengthOf(1)
expect(videoDetails.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
const file = videoDetails.files[0] const file = videoDetails.files[0]
const magnetUri = file.magnetUri const magnetUri = file.magnetUri
@ -201,7 +201,6 @@ describe('Test multiple servers', function () {
expect(video.description).to.equal('my super description for server 2') expect(video.description).to.equal('my super description for server 2')
expect(video.serverHost).to.equal('localhost:9002') expect(video.serverHost).to.equal('localhost:9002')
expect(video.duration).to.equal(5) expect(video.duration).to.equal(5)
expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
expect(dateIsValid(video.createdAt)).to.be.true expect(dateIsValid(video.createdAt)).to.be.true
expect(dateIsValid(video.updatedAt)).to.be.true expect(dateIsValid(video.updatedAt)).to.be.true
expect(video.accountName).to.equal('user1') expect(video.accountName).to.equal('user1')
@ -218,6 +217,7 @@ describe('Test multiple servers', function () {
expect(videoDetails.channel.name).to.equal('Default user1 channel') expect(videoDetails.channel.name).to.equal('Default user1 channel')
expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true
expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true
expect(videoDetails.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
expect(videoDetails.files).to.have.lengthOf(4) expect(videoDetails.files).to.have.lengthOf(4)
@ -318,7 +318,6 @@ describe('Test multiple servers', function () {
expect(video1.description).to.equal('my super description for server 3') expect(video1.description).to.equal('my super description for server 3')
expect(video1.serverHost).to.equal('localhost:9003') expect(video1.serverHost).to.equal('localhost:9003')
expect(video1.duration).to.equal(5) expect(video1.duration).to.equal(5)
expect(video1.tags).to.deep.equal([ 'tag1p3' ])
expect(video1.accountName).to.equal('root') expect(video1.accountName).to.equal('root')
expect(dateIsValid(video1.createdAt)).to.be.true expect(dateIsValid(video1.createdAt)).to.be.true
expect(dateIsValid(video1.updatedAt)).to.be.true expect(dateIsValid(video1.updatedAt)).to.be.true
@ -326,6 +325,7 @@ describe('Test multiple servers', function () {
const res2 = await getVideo(server.url, video1.id) const res2 = await getVideo(server.url, video1.id)
const video1Details = res2.body const video1Details = res2.body
expect(video1Details.files).to.have.lengthOf(1) expect(video1Details.files).to.have.lengthOf(1)
expect(video1Details.tags).to.deep.equal([ 'tag1p3' ])
const file1 = video1Details.files[0] const file1 = video1Details.files[0]
expect(file1.magnetUri).to.have.lengthOf.above(2) expect(file1.magnetUri).to.have.lengthOf.above(2)
@ -344,13 +344,13 @@ describe('Test multiple servers', function () {
expect(video2.description).to.equal('my super description for server 3-2') expect(video2.description).to.equal('my super description for server 3-2')
expect(video2.serverHost).to.equal('localhost:9003') expect(video2.serverHost).to.equal('localhost:9003')
expect(video2.duration).to.equal(5) expect(video2.duration).to.equal(5)
expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ])
expect(video2.accountName).to.equal('root') expect(video2.accountName).to.equal('root')
expect(dateIsValid(video2.createdAt)).to.be.true expect(dateIsValid(video2.createdAt)).to.be.true
expect(dateIsValid(video2.updatedAt)).to.be.true expect(dateIsValid(video2.updatedAt)).to.be.true
const res3 = await getVideo(server.url, video2.id) const res3 = await getVideo(server.url, video2.id)
const video2Details = res3.body const video2Details = res3.body
expect(video2Details.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ])
expect(video2Details.files).to.have.lengthOf(1) expect(video2Details.files).to.have.lengthOf(1)
@ -624,13 +624,13 @@ describe('Test multiple servers', function () {
expect(videoUpdated.languageLabel).to.equal('French') expect(videoUpdated.languageLabel).to.equal('French')
expect(videoUpdated.nsfw).to.be.ok expect(videoUpdated.nsfw).to.be.ok
expect(videoUpdated.description).to.equal('my super description updated') expect(videoUpdated.description).to.equal('my super description updated')
expect(videoUpdated.tags).to.deep.equal([ 'tag_up_1', 'tag_up_2' ])
expect(dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true expect(dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true
const res2 = await getVideo(server.url, videoUpdated.uuid) const res2 = await getVideo(server.url, videoUpdated.uuid)
const videoUpdatedDetails = res2.body const videoUpdatedDetails = res2.body
expect(videoUpdatedDetails.tags).to.deep.equal([ 'tag_up_1', 'tag_up_2' ])
const file = videoUpdatedDetails .files[0] const file = videoUpdatedDetails.files[0]
expect(file.magnetUri).to.have.lengthOf.above(2) expect(file.magnetUri).to.have.lengthOf.above(2)
expect(file.resolution).to.equal(720) expect(file.resolution).to.equal(720)
expect(file.resolutionLabel).to.equal('720p') expect(file.resolutionLabel).to.equal('720p')
@ -746,7 +746,6 @@ describe('Test multiple servers', function () {
expect(video.description).to.equal(null) expect(video.description).to.equal(null)
expect(video.serverHost).to.equal('localhost:9002') expect(video.serverHost).to.equal('localhost:9002')
expect(video.accountName).to.equal('root') expect(video.accountName).to.equal('root')
expect(video.tags).to.deep.equal([ ])
expect(dateIsValid(video.createdAt)).to.be.true expect(dateIsValid(video.createdAt)).to.be.true
expect(dateIsValid(video.updatedAt)).to.be.true expect(dateIsValid(video.updatedAt)).to.be.true
} }