aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/client.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-10 12:26:47 +0200
committerChocobozzz <me@florianbigard.com>2018-05-11 08:48:20 +0200
commit8be1afa12b700b93ed92365cab05c0ef81d643aa (patch)
tree563369bded16d3612a631bb1a9b068b2bb76abe8 /server/tests/client.ts
parentc7b0dacb28e3b5aa9f43a7a0eb683e2af9826cb9 (diff)
downloadPeerTube-8be1afa12b700b93ed92365cab05c0ef81d643aa.tar.gz
PeerTube-8be1afa12b700b93ed92365cab05c0ef81d643aa.tar.zst
PeerTube-8be1afa12b700b93ed92365cab05c0ef81d643aa.zip
Add ability to embed a video in Twitter
The instance should be whitelisted first
Diffstat (limited to 'server/tests/client.ts')
-rw-r--r--server/tests/client.ts30
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
17describe('Test a client controllers', function () { 17describe('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