/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import 'mocha'
-import * as chai from 'chai'
-import { omit } from 'lodash'
-import { Account, HTMLServerConfig, HttpStatusCode, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
+import { expect } from 'chai'
+import { omit } from '@shared/core-utils'
+import {
+ Account,
+ HTMLServerConfig,
+ HttpStatusCode,
+ ServerConfig,
+ VideoPlaylistCreateResult,
+ VideoPlaylistPrivacy,
+ VideoPrivacy
+} from '@shared/models'
import {
cleanupTests,
createMultipleServers,
waitJobs
} from '../../shared/server-commands'
-const expect = chai.expect
-
function checkIndexTags (html: string, title: string, description: string, css: string, config: ServerConfig) {
expect(html).to.contain('<title>' + title + '</title>')
expect(html).to.contain('<meta name="description" content="' + description + '" />')
expect(html).to.contain('<style class="custom-css-style">' + css + '</style>')
- const htmlConfig: HTMLServerConfig = omit(config, 'signup')
+ const htmlConfig: HTMLServerConfig = omit(config, [ 'signup' ])
const configObjectString = JSON.stringify(htmlConfig)
const configEscapedString = JSON.stringify(configObjectString)
expectedStatus: HttpStatusCode.OK_200
})
- const port = servers[0].port
-
- const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' +
- `url=http%3A%2F%2Flocalhost%3A${port}%2Fw%2F${servers[0].store.video.shortUUID}" ` +
- `title="${servers[0].store.video.name}" />`
+ const expectedLink = `<link rel="alternate" type="application/json+oembed" href="${servers[0].url}/services/oembed?` +
+ `url=http%3A%2F%2F${servers[0].hostname}%3A${servers[0].port}%2Fw%2F${servers[0].store.video.shortUUID}" ` +
+ `title="${servers[0].store.video.name}" />`
expect(res.text).to.contain(expectedLink)
}
expectedStatus: HttpStatusCode.OK_200
})
- const port = servers[0].port
-
- const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' +
- `url=http%3A%2F%2Flocalhost%3A${port}%2Fw%2Fp%2F${playlist.shortUUID}" ` +
+ const expectedLink = `<link rel="alternate" type="application/json+oembed" href="${servers[0].url}/services/oembed?` +
+ `url=http%3A%2F%2F${servers[0].hostname}%3A${servers[0].port}%2Fw%2Fp%2F${playlist.shortUUID}" ` +
`title="${playlistName}" />`
expect(res.text).to.contain(expectedLink)
}
})
+ it('Should have valid Open Graph tags on the watch page with thread id Angular param', async function () {
+ for (const path of watchVideoBasePaths) {
+ for (const id of videoIds) {
+ await watchVideoPageTest(path + id + ';threadId=1')
+ }
+ }
+ })
+
it('Should have valid Open Graph tags on the watch playlist page', async function () {
for (const path of watchPlaylistBasePaths) {
for (const id of playlistIds) {
expect(res.text).to.contain('<meta name="robots" content="noindex" />')
}
})
-
- it('Should add noindex meta tag for remote accounts', async function () {
- const handle = 'root_channel@' + servers[0].host
- const paths = [ '/video-channels/', '/c/', '/@' ]
-
- for (const path of paths) {
- {
- const { text } = await makeHTMLRequest(servers[1].url, path + handle)
- expect(text).to.contain('<meta name="robots" content="noindex" />')
- }
-
- {
- const { text } = await makeHTMLRequest(servers[0].url, path + handle)
- expect(text).to.not.contain('<meta name="robots" content="noindex" />')
- }
- }
- })
})
describe('Embed HTML', function () {