diff options
Diffstat (limited to 'server/tests/client.js')
-rw-r--r-- | server/tests/client.js | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/server/tests/client.js b/server/tests/client.js deleted file mode 100644 index 0cdf0a260..000000000 --- a/server/tests/client.js +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* eslint-disable no-unused-expressions */ | ||
2 | |||
3 | 'use strict' | ||
4 | |||
5 | const chai = require('chai') | ||
6 | const expect = chai.expect | ||
7 | const request = require('supertest') | ||
8 | const series = require('async/series') | ||
9 | |||
10 | const loginUtils = require('./utils/login') | ||
11 | const serversUtils = require('./utils/servers') | ||
12 | const videosUtils = require('./utils/videos') | ||
13 | |||
14 | describe('Test a client controllers', function () { | ||
15 | let server = null | ||
16 | |||
17 | before(function (done) { | ||
18 | this.timeout(120000) | ||
19 | |||
20 | series([ | ||
21 | function (next) { | ||
22 | serversUtils.flushTests(next) | ||
23 | }, | ||
24 | function (next) { | ||
25 | serversUtils.runServer(1, function (server1) { | ||
26 | server = server1 | ||
27 | next() | ||
28 | }) | ||
29 | }, | ||
30 | function (next) { | ||
31 | loginUtils.loginAndGetAccessToken(server, function (err, token) { | ||
32 | if (err) throw err | ||
33 | server.accessToken = token | ||
34 | next() | ||
35 | }) | ||
36 | }, | ||
37 | function (next) { | ||
38 | const videoAttributes = { | ||
39 | name: 'my super name for pod 1', | ||
40 | description: 'my super description for pod 1' | ||
41 | } | ||
42 | videosUtils.uploadVideo(server.url, server.accessToken, videoAttributes, next) | ||
43 | }, | ||
44 | function (next) { | ||
45 | videosUtils.getVideosList(server.url, function (err, res) { | ||
46 | if (err) throw err | ||
47 | |||
48 | const videos = res.body.data | ||
49 | |||
50 | expect(videos.length).to.equal(1) | ||
51 | |||
52 | server.video = videos[0] | ||
53 | |||
54 | next() | ||
55 | }) | ||
56 | } | ||
57 | ], done) | ||
58 | }) | ||
59 | |||
60 | it('It should have valid opengraph tags on the watch page with video id', function (done) { | ||
61 | request(server.url) | ||
62 | .get('/videos/watch/' + server.video.id) | ||
63 | .expect(200, function (err, res) { | ||
64 | if (err) throw err | ||
65 | |||
66 | expect(res.text).to.contain('<meta property="og:title" content="my super name for pod 1" />') | ||
67 | expect(res.text).to.contain('<meta property="og:description" content="my super description for pod 1" />') | ||
68 | |||
69 | done() | ||
70 | }) | ||
71 | }) | ||
72 | |||
73 | it('It should have valid opengraph tags on the watch page with video uuid', function (done) { | ||
74 | request(server.url) | ||
75 | .get('/videos/watch/' + server.video.uuid) | ||
76 | .expect(200, function (err, res) { | ||
77 | if (err) throw err | ||
78 | |||
79 | expect(res.text).to.contain('<meta property="og:title" content="my super name for pod 1" />') | ||
80 | expect(res.text).to.contain('<meta property="og:description" content="my super description for pod 1" />') | ||
81 | |||
82 | done() | ||
83 | }) | ||
84 | }) | ||
85 | |||
86 | after(function (done) { | ||
87 | process.kill(-server.app.pid) | ||
88 | |||
89 | // Keep the logs if the test failed | ||
90 | if (this.ok) { | ||
91 | serversUtils.flushTests(done) | ||
92 | } else { | ||
93 | done() | ||
94 | } | ||
95 | }) | ||
96 | }) | ||