diff --git a/packages/tests/src/client/index-html.ts b/packages/tests/src/client/index-html.ts
index f7eda2753..06a99f78b 100644
--- a/packages/tests/src/client/index-html.ts
+++ b/packages/tests/src/client/index-html.ts
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai'
-import { HttpStatusCode, VideoPlaylistCreateResult } from '@peertube/peertube-models'
+import { HttpStatusCode, ServerConfig, VideoPlaylistCreateResult } from '@peertube/peertube-models'
import { cleanupTests, makeGetRequest, makeHTMLRequest, PeerTubeServer } from '@peertube/peertube-server-commands'
import { checkIndexTags, getWatchPlaylistBasePaths, getWatchVideoBasePaths, prepareClientTests } from '@tests/shared/client.js'
@@ -25,6 +25,8 @@ describe('Test index HTML generation', function () {
shortDescription: string
}
+ const getTitleWithSuffix = (title: string, config: ServerConfig) => `${title} - ${config.instance.name}`
+
before(async function () {
this.timeout(120000);
@@ -49,7 +51,7 @@ describe('Test index HTML generation', function () {
const config = await servers[0].config.getConfig()
const res = await makeHTMLRequest(servers[0].url, '/videos/trending')
- checkIndexTags(res.text, instanceConfig.name, instanceConfig.shortDescription, '', config)
+ checkIndexTags(res.text, getTitleWithSuffix('Trending', config), instanceConfig.shortDescription, '', config)
})
it('Should update the customized configuration and have the correct index html tags', async function () {
@@ -73,20 +75,25 @@ describe('Test index HTML generation', function () {
const config = await servers[0].config.getConfig()
const res = await makeHTMLRequest(servers[0].url, '/videos/trending')
- checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config)
+ checkIndexTags(res.text, getTitleWithSuffix('Trending', config), 'my short description', 'body { background-color: red; }', config)
})
it('Should have valid index html updated tags (title, description...)', async function () {
const config = await servers[0].config.getConfig()
const res = await makeHTMLRequest(servers[0].url, '/videos/trending')
- checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config)
+ checkIndexTags(res.text, getTitleWithSuffix('Trending', config), 'my short description', 'body { background-color: red; }', config)
})
})
describe('Canonical tags', function () {
it('Should use the original video URL for the canonical tag', async function () {
+ const res = await makeHTMLRequest(servers[0].url, '/videos/trending?page=2')
+ expect(res.text).to.contain(``)
+ })
+
+ it('Should use pagination in video URL for the canonical tag', async function () {
for (const basePath of getWatchVideoBasePaths()) {
for (const id of videoIds) {
const res = await makeHTMLRequest(servers[0].url, basePath + id)
@@ -114,6 +121,18 @@ describe('Test index HTML generation', function () {
accountURLtest(await makeHTMLRequest(servers[0].url, '/@root@' + servers[0].host))
})
+ it('Should use pagination in account video channels URL for the canonical tag', async function () {
+ const res = await makeHTMLRequest(servers[0].url, '/a/root/video-channels?page=2')
+
+ expect(res.text).to.contain(``)
+ })
+
+ it('Should use pagination in account videos URL for the canonical tag', async function () {
+ const res = await makeHTMLRequest(servers[0].url, '/a/root/videos?page=2')
+
+ expect(res.text).to.contain(``)
+ })
+
it('Should use the original channel URL for the canonical tag', async function () {
const channelURLtests = res => {
expect(res.text).to.contain(``)
@@ -123,6 +142,18 @@ describe('Test index HTML generation', function () {
channelURLtests(await makeHTMLRequest(servers[0].url, '/c/root_channel@' + servers[0].host))
channelURLtests(await makeHTMLRequest(servers[0].url, '/@root_channel@' + servers[0].host))
})
+
+ it('Should use pagination in channel videos URL for the canonical tag', async function () {
+ const res = await makeHTMLRequest(servers[0].url, '/c/root_channel/videos?page=2')
+
+ expect(res.text).to.contain(``)
+ })
+
+ it('Should use pagination in channel playlists URL for the canonical tag', async function () {
+ const res = await makeHTMLRequest(servers[0].url, '/c/root_channel/video-playlists?page=2')
+
+ expect(res.text).to.contain(``)
+ })
})
describe('Indexation tags', function () {
diff --git a/packages/tests/src/client/og-twitter-tags.ts b/packages/tests/src/client/og-twitter-tags.ts
index f0fc8943f..5d9b92704 100644
--- a/packages/tests/src/client/og-twitter-tags.ts
+++ b/packages/tests/src/client/og-twitter-tags.ts
@@ -62,6 +62,20 @@ describe('Test Open Graph and Twitter cards HTML tags', function () {
expect(text).to.contain(``))
+ expect(text).to.contain(``)
+ expect(text).to.contain('')
+ expect(text).to.contain(`