aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/tests/client.js96
-rw-r--r--server/tests/index.js1
2 files changed, 97 insertions, 0 deletions
diff --git a/server/tests/client.js b/server/tests/client.js
new file mode 100644
index 000000000..0cdf0a260
--- /dev/null
+++ b/server/tests/client.js
@@ -0,0 +1,96 @@
1/* eslint-disable no-unused-expressions */
2
3'use strict'
4
5const chai = require('chai')
6const expect = chai.expect
7const request = require('supertest')
8const series = require('async/series')
9
10const loginUtils = require('./utils/login')
11const serversUtils = require('./utils/servers')
12const videosUtils = require('./utils/videos')
13
14describe('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})
diff --git a/server/tests/index.js b/server/tests/index.js
index cb177b87c..0bc0523a5 100644
--- a/server/tests/index.js
+++ b/server/tests/index.js
@@ -1,4 +1,5 @@
1'use strict' 1'use strict'
2 2
3// Order of the tests we want to execute 3// Order of the tests we want to execute
4require('./client')
4require('./api/') 5require('./api/')