+ expect(res.text).to.contain(`<meta property="og:title" content="${videoName}" />`)
+ expect(res.text).to.contain(`<meta property="og:description" content="${videoDescription}" />`)
+ expect(res.text).to.contain('<meta property="og:type" content="video" />')
+ expect(res.text).to.contain(`<meta property="og:url" content="${server.url}/videos/watch/${server.video.uuid}" />`)
+ })
+
+ it('Should have valid Open Graph tags on the watch page with video uuid', async function () {
+ const res = await request(server.url)
+ .get('/videos/watch/' + server.video.uuid)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(res.text).to.contain(`<meta property="og:title" content="${videoName}" />`)
+ expect(res.text).to.contain(`<meta property="og:description" content="${videoDescription}" />`)
+ expect(res.text).to.contain('<meta property="og:type" content="video" />')
+ expect(res.text).to.contain(`<meta property="og:url" content="${server.url}/videos/watch/${server.video.uuid}" />`)
+ })
+
+ it('Should have valid Open Graph tags on the watch playlist page', async function () {
+ const res = await request(server.url)
+ .get('/videos/watch/playlist/' + playlistUUID)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(res.text).to.contain(`<meta property="og:title" content="${playlistName}" />`)
+ expect(res.text).to.contain(`<meta property="og:description" content="${playlistDescription}" />`)
+ expect(res.text).to.contain('<meta property="og:type" content="video" />')
+ expect(res.text).to.contain(`<meta property="og:url" content="${server.url}/videos/watch/playlist/${playlistUUID}" />`)
+ })
+ })
+
+ describe('Twitter card', async function () {
+
+ it('Should have valid twitter card on the watch video page', async function () {
+ const res = await request(server.url)
+ .get('/videos/watch/' + server.video.uuid)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(res.text).to.contain('<meta property="twitter:card" content="summary_large_image" />')
+ expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />')
+ expect(res.text).to.contain(`<meta property="twitter:title" content="${videoName}" />`)
+ expect(res.text).to.contain(`<meta property="twitter:description" content="${videoDescription}" />`)
+ })
+
+ it('Should have valid twitter card on the watch playlist page', async function () {
+ const res = await request(server.url)
+ .get('/videos/watch/playlist/' + playlistUUID)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(res.text).to.contain('<meta property="twitter:card" content="summary" />')
+ expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />')
+ expect(res.text).to.contain(`<meta property="twitter:title" content="${playlistName}" />`)
+ expect(res.text).to.contain(`<meta property="twitter:description" content="${playlistDescription}" />`)
+ })
+
+ it('Should have valid twitter card on the account page', async function () {
+ const res = await request(server.url)
+ .get('/accounts/' + account.name)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(res.text).to.contain('<meta property="twitter:card" content="summary" />')
+ expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />')
+ expect(res.text).to.contain(`<meta property="twitter:title" content="${account.name}" />`)
+ expect(res.text).to.contain(`<meta property="twitter:description" content="${account.description}" />`)
+ })
+
+ it('Should have valid twitter card on the channel page', async function () {
+ const res = await request(server.url)
+ .get('/video-channels/' + server.videoChannel.name)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(res.text).to.contain('<meta property="twitter:card" content="summary" />')
+ expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />')
+ expect(res.text).to.contain(`<meta property="twitter:title" content="${server.videoChannel.displayName}" />`)
+ expect(res.text).to.contain(`<meta property="twitter:description" content="${channelDescription}" />`)
+ })
+
+ it('Should have valid twitter card if Twitter is whitelisted', async function () {
+ const res1 = await getCustomConfig(server.url, server.accessToken)
+ const config = res1.body
+ config.services.twitter = {
+ username: '@Kuja',
+ whitelisted: true
+ }
+ await updateCustomConfig(server.url, server.accessToken, config)
+
+ const resVideoRequest = await request(server.url)
+ .get('/videos/watch/' + server.video.uuid)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(resVideoRequest.text).to.contain('<meta property="twitter:card" content="player" />')
+ expect(resVideoRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />')
+
+ const resVideoPlaylistRequest = await request(server.url)
+ .get('/videos/watch/playlist/' + playlistUUID)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(resVideoPlaylistRequest.text).to.contain('<meta property="twitter:card" content="player" />')
+ expect(resVideoPlaylistRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />')
+
+ const resAccountRequest = await request(server.url)
+ .get('/accounts/' + account.name)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(resAccountRequest.text).to.contain('<meta property="twitter:card" content="summary" />')
+ expect(resAccountRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />')
+
+ const resChannelRequest = await request(server.url)
+ .get('/video-channels/' + server.videoChannel.name)
+ .set('Accept', 'text/html')
+ .expect(200)
+
+ expect(resChannelRequest.text).to.contain('<meta property="twitter:card" content="summary" />')
+ expect(resChannelRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />')
+ })