diff options
Diffstat (limited to 'server/tests/client.ts')
-rw-r--r-- | server/tests/client.ts | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/server/tests/client.ts b/server/tests/client.ts index 2be1cf5dd..2adb39c5e 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts | |||
@@ -11,7 +11,7 @@ import { | |||
11 | runServer, | 11 | runServer, |
12 | serverLogin, | 12 | serverLogin, |
13 | uploadVideo, | 13 | uploadVideo, |
14 | getVideosList | 14 | getVideosList, updateCustomConfig, getCustomConfig |
15 | } from './utils' | 15 | } from './utils' |
16 | 16 | ||
17 | describe('Test a client controllers', function () { | 17 | describe('Test a client controllers', function () { |
@@ -73,6 +73,34 @@ describe('Test a client controllers', function () { | |||
73 | expect(res.text).to.contain(expectedLink) | 73 | expect(res.text).to.contain(expectedLink) |
74 | }) | 74 | }) |
75 | 75 | ||
76 | it('Should have valid twitter card', async function () { | ||
77 | const res = await request(server.url) | ||
78 | .get('/videos/watch/' + server.video.uuid) | ||
79 | .set('Accept', 'text/html') | ||
80 | .expect(200) | ||
81 | |||
82 | expect(res.text).to.contain('<meta property="twitter:card" content="summary_large_image" />') | ||
83 | expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') | ||
84 | }) | ||
85 | |||
86 | it('Should have valid twitter card if Twitter is whitelisted', async function () { | ||
87 | const res1 = await getCustomConfig(server.url, server.accessToken) | ||
88 | const config = res1.body | ||
89 | config.services.twitter = { | ||
90 | username: '@Kuja', | ||
91 | whitelisted: true | ||
92 | } | ||
93 | await updateCustomConfig(server.url, server.accessToken, config) | ||
94 | |||
95 | const res = await request(server.url) | ||
96 | .get('/videos/watch/' + server.video.uuid) | ||
97 | .set('Accept', 'text/html') | ||
98 | .expect(200) | ||
99 | |||
100 | expect(res.text).to.contain('<meta property="twitter:card" content="player" />') | ||
101 | expect(res.text).to.contain('<meta property="twitter:site" content="@Kuja" />') | ||
102 | }) | ||
103 | |||
76 | after(async function () { | 104 | after(async function () { |
77 | process.kill(-server.app.pid) | 105 | process.kill(-server.app.pid) |
78 | 106 | ||