1 /* tslint:disable:no-unused-expression */
4 import * as chai from 'chai'
5 import * as request from 'supertest'
6 const expect = chai.expect
17 describe('Test a client controllers', function () {
18 let server: ServerInfo
20 before(async function () {
25 server = await runServer(1)
26 server.accessToken = await serverLogin(server)
28 const videoAttributes = {
29 name: 'my super name for server 1',
30 description: 'my super description for server 1'
32 await uploadVideo(server.url, server.accessToken, videoAttributes)
34 const res = await getVideosList(server.url)
35 const videos = res.body.data
37 expect(videos.length).to.equal(1)
39 server.video = videos[0]
42 it('Should have valid Open Graph tags on the watch page with video id', async function () {
43 const res = await request(server.url)
44 .get('/videos/watch/' + server.video.id)
45 .set('Accept', 'text/html')
48 expect(res.text).to.contain('<meta property="og:title" content="my super name for server 1" />')
49 expect(res.text).to.contain('<meta property="og:description" content="my super description for server 1" />')
52 it('Should have valid Open Graph tags on the watch page with video uuid', async function () {
53 const res = await request(server.url)
54 .get('/videos/watch/' + server.video.uuid)
55 .set('Accept', 'text/html')
58 expect(res.text).to.contain('<meta property="og:title" content="my super name for server 1" />')
59 expect(res.text).to.contain('<meta property="og:description" content="my super description for server 1" />')
62 it('Should have valid oEmbed discovery tags', async function () {
63 const path = '/videos/watch/' + server.video.uuid
64 const res = await request(server.url)
66 .set('Accept', 'text/html')
69 const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:9001/services/oembed?' +
70 `url=http%3A%2F%2Flocalhost%3A9001%2Fvideos%2Fwatch%2F${server.video.uuid}" ` +
71 `title="${server.video.name}" />`
73 expect(res.text).to.contain(expectedLink)
76 after(async function () {
77 process.kill(-server.app.pid)
79 // Keep the logs if the test failed