From e5024f5181b2e8ec23a58a821671000041b5bf2b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 6 Dec 2020 19:23:12 +0100 Subject: Add tests Signed-off-by: Thomas Citharel --- server/tests/client.ts | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'server') diff --git a/server/tests/client.ts b/server/tests/client.ts index 6dd4b7cf6..7bcb999ea 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts @@ -8,19 +8,20 @@ import { addVideoInPlaylist, cleanupTests, createVideoPlaylist, - flushAndRunServer, getAccount, getCustomConfig, getVideosList, makeHTMLRequest, ServerInfo, - serverLogin, setDefaultVideoChannel, updateCustomConfig, updateCustomSubConfig, uploadVideo, updateMyUser, - updateVideoChannel + updateVideoChannel, + doubleFollow, + flushAndRunMultipleServers, + setAccessTokensToServers } from '../../shared/extra-utils' import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' @@ -33,8 +34,11 @@ function checkIndexTags (html: string, title: string, description: string, css: } describe('Test a client controllers', function () { + let servers: ServerInfo[] = [] let server: ServerInfo let account: Account + let videoUUID: string + let videoOriginalUrl: string const videoName = 'my super name for server 1' const videoDescription = 'my super description for server 1' @@ -48,8 +52,19 @@ describe('Test a client controllers', function () { before(async function () { this.timeout(120000) - server = await flushAndRunServer(1) - server.accessToken = await serverLogin(server) + servers = await flushAndRunMultipleServers(2) + const server = servers[0] + + await setAccessTokensToServers(servers) + + { + const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' }) + videoUUID = res.body.video.uuid + videoOriginalUrl = res.body.video.url + } + + await doubleFollow(servers[0], servers[1]) + await setDefaultVideoChannel([ server ]) await updateVideoChannel(server.url, server.accessToken, server.videoChannel.name, { description: channelDescription }) @@ -319,6 +334,11 @@ describe('Test a client controllers', function () { checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }') }) + + it('Should use the original video URL for the canonical tag', async function () { + const res = await makeHTMLRequest(servers[1].url, '/videos/watch/' + videoUUID) + expect(res.text).to.contain(``) + }) }) after(async function () { -- cgit v1.2.3