From 69f224587e99d56008e1fa129d0641840a486620 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 2 Aug 2017 21:44:01 +0200 Subject: Fix tests --- server/tests/api/config.js | 12 ++++-------- server/tests/api/multiple-pods.js | 10 +++++----- server/tests/api/single-pod.js | 14 +++++++------- server/tests/api/users.js | 18 +++++++++--------- 4 files changed, 25 insertions(+), 29 deletions(-) diff --git a/server/tests/api/config.js b/server/tests/api/config.js index f2c00f85a..052b3f036 100644 --- a/server/tests/api/config.js +++ b/server/tests/api/config.js @@ -44,19 +44,15 @@ describe('Test config', function () { it('Should have a correct config on a server with registration enabled and a users limit', function (done) { series([ function (next) { - usersUtils.registerUser(server.url, 'user1', 'super password', done) + usersUtils.registerUser(server.url, 'user1', 'super password', next) }, function (next) { - usersUtils.registerUser(server.url, 'user2', 'super password', done) + usersUtils.registerUser(server.url, 'user2', 'super password', next) }, function (next) { - usersUtils.registerUser(server.url, 'user3', 'super password', done) - }, - - function (next) { - usersUtils.registerUser(server.url, 'user4', 'super password', done) + usersUtils.registerUser(server.url, 'user3', 'super password', next) } ], function (err) { @@ -67,7 +63,7 @@ describe('Test config', function () { const data = res.body - expect(data.signup.allowed).to.be.truthy + expect(data.signup.allowed).to.be.false done() }) diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js index 7753e6f2d..abbc2caf4 100644 --- a/server/tests/api/multiple-pods.js +++ b/server/tests/api/multiple-pods.js @@ -118,7 +118,7 @@ describe('Test multiple pods', function () { expect(video.licenceLabel).to.equal('Attribution - Non Commercial') expect(video.language).to.equal(9) expect(video.languageLabel).to.equal('Japanese') - expect(video.nsfw).to.be.truthy + expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description for pod 1') expect(video.podHost).to.equal('localhost:9001') expect(video.magnetUri).to.exist @@ -195,7 +195,7 @@ describe('Test multiple pods', function () { expect(video.licenceLabel).to.equal('Attribution - No Derivatives') expect(video.language).to.equal(11) expect(video.languageLabel).to.equal('German') - expect(video.nsfw).to.be.falsy + expect(video.nsfw).to.be.true expect(video.description).to.equal('my super description for pod 2') expect(video.podHost).to.equal('localhost:9002') expect(video.magnetUri).to.exist @@ -294,7 +294,7 @@ describe('Test multiple pods', function () { expect(video1.licenceLabel).to.equal('Attribution - Non Commercial - Share Alike') expect(video1.language).to.equal(11) expect(video1.languageLabel).to.equal('German') - expect(video1.nsfw).to.be.truthy + expect(video1.nsfw).to.be.ok expect(video1.description).to.equal('my super description for pod 3') expect(video1.podHost).to.equal('localhost:9003') expect(video1.magnetUri).to.exist @@ -311,7 +311,7 @@ describe('Test multiple pods', function () { expect(video2.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') expect(video2.language).to.equal(12) expect(video2.languageLabel).to.equal('Korean') - expect(video2.nsfw).to.be.falsy + expect(video2.nsfw).to.be.false expect(video2.description).to.equal('my super description for pod 3-2') expect(video2.podHost).to.equal('localhost:9003') expect(video2.magnetUri).to.exist @@ -695,7 +695,7 @@ describe('Test multiple pods', function () { expect(videoUpdated.licenceLabel).to.equal('Public Domain Dedication') expect(videoUpdated.language).to.equal(13) expect(videoUpdated.languageLabel).to.equal('French') - expect(videoUpdated.nsfw).to.be.truthy + expect(videoUpdated.nsfw).to.be.ok expect(videoUpdated.description).to.equal('my super description updated') expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js index 0dac9a183..1258e7e55 100644 --- a/server/tests/api/single-pod.js +++ b/server/tests/api/single-pod.js @@ -126,7 +126,7 @@ describe('Test a single pod', function () { expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') expect(video.language).to.equal(3) expect(video.languageLabel).to.equal('Mandarin') - expect(video.nsfw).to.be.truthy + expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description') expect(video.podHost).to.equal('localhost:9001') expect(video.magnetUri).to.exist @@ -169,7 +169,7 @@ describe('Test a single pod', function () { expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') expect(video.language).to.equal(3) expect(video.languageLabel).to.equal('Mandarin') - expect(video.nsfw).to.be.truthy + expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description') expect(video.podHost).to.equal('localhost:9001') expect(video.magnetUri).to.exist @@ -231,7 +231,7 @@ describe('Test a single pod', function () { expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') expect(video.language).to.equal(3) expect(video.languageLabel).to.equal('Mandarin') - expect(video.nsfw).to.be.truthy + expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description') expect(video.podHost).to.equal('localhost:9001') expect(video.author).to.equal('root') @@ -293,7 +293,7 @@ describe('Test a single pod', function () { expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') expect(video.language).to.equal(3) expect(video.languageLabel).to.equal('Mandarin') - expect(video.nsfw).to.be.truthy + expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description') expect(video.podHost).to.equal('localhost:9001') expect(video.author).to.equal('root') @@ -641,7 +641,7 @@ describe('Test a single pod', function () { expect(video.licenceLabel).to.equal('Attribution - Share Alike') expect(video.language).to.equal(5) expect(video.languageLabel).to.equal('Arabic') - expect(video.nsfw).to.be.truthy + expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description updated') expect(video.podHost).to.equal('localhost:9001') expect(video.author).to.equal('root') @@ -685,7 +685,7 @@ describe('Test a single pod', function () { expect(video.licenceLabel).to.equal('Attribution - Share Alike') expect(video.language).to.equal(5) expect(video.languageLabel).to.equal('Arabic') - expect(video.nsfw).to.be.truthy + expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description updated') expect(video.podHost).to.equal('localhost:9001') expect(video.author).to.equal('root') @@ -719,7 +719,7 @@ describe('Test a single pod', function () { expect(video.licenceLabel).to.equal('Attribution - Share Alike') expect(video.language).to.equal(5) expect(video.languageLabel).to.equal('Arabic') - expect(video.nsfw).to.be.truthy + expect(video.nsfw).to.be.ok expect(video.description).to.equal('hello everybody') expect(video.podHost).to.equal('localhost:9001') expect(video.author).to.equal('root') diff --git a/server/tests/api/users.js b/server/tests/api/users.js index 74477ae2d..dacecf295 100644 --- a/server/tests/api/users.js +++ b/server/tests/api/users.js @@ -209,7 +209,7 @@ describe('Test users', function () { expect(user.username).to.equal('user_1') expect(user.email).to.equal('user_1@example.com') - expect(user.displayNSFW).to.be.falsy + expect(user.displayNSFW).to.be.false expect(user.id).to.exist done() @@ -238,12 +238,12 @@ describe('Test users', function () { const user = users[0] expect(user.username).to.equal('user_1') expect(user.email).to.equal('user_1@example.com') - expect(user.displayNSFW).to.be.falsy + expect(user.displayNSFW).to.be.false const rootUser = users[1] expect(rootUser.username).to.equal('root') expect(rootUser.email).to.equal('admin1@example.com') - expect(rootUser.displayNSFW).to.be.falsy + expect(rootUser.displayNSFW).to.be.false userId = user.id @@ -265,7 +265,7 @@ describe('Test users', function () { const user = users[0] expect(user.username).to.equal('root') expect(user.email).to.equal('admin1@example.com') - expect(user.displayNSFW).to.be.falsy + expect(user.displayNSFW).to.be.false done() }) @@ -285,7 +285,7 @@ describe('Test users', function () { const user = users[0] expect(user.username).to.equal('user_1') expect(user.email).to.equal('user_1@example.com') - expect(user.displayNSFW).to.be.falsy + expect(user.displayNSFW).to.be.false done() }) @@ -305,7 +305,7 @@ describe('Test users', function () { const user = users[0] expect(user.username).to.equal('user_1') expect(user.email).to.equal('user_1@example.com') - expect(user.displayNSFW).to.be.falsy + expect(user.displayNSFW).to.be.false done() }) @@ -324,11 +324,11 @@ describe('Test users', function () { expect(users[0].username).to.equal('root') expect(users[0].email).to.equal('admin1@example.com') - expect(users[0].displayNSFW).to.be.falsy + expect(users[0].displayNSFW).to.be.false expect(users[1].username).to.equal('user_1') expect(users[1].email).to.equal('user_1@example.com') - expect(users[1].displayNSFW).to.be.falsy + expect(users[1].displayNSFW).to.be.false done() }) @@ -354,7 +354,7 @@ describe('Test users', function () { expect(user.username).to.equal('user_1') expect(user.email).to.equal('user_1@example.com') - expect(user.displayNSFW).to.be.truthy + expect(user.displayNSFW).to.be.ok expect(user.id).to.exist done() -- cgit v1.2.3