Fix services tests

This commit is contained in:
Chocobozzz
2025-02-13 16:32:21 +01:00
parent 327360c6b1
commit a4d9c461bb

View File

@@ -12,8 +12,11 @@ import {
describe('Test services', function () {
let server: PeerTubeServer = null
let playlistShortUUID: string
let playlistUUID: string
let playlistDisplayName: string
let video: Video
const urlSuffixes = [
@@ -57,6 +60,7 @@ describe('Test services', function () {
})
playlistUUID = created.uuid
playlistShortUUID = created.shortUUID
playlistDisplayName = 'The Life and Times of Scrooge McDuck'
await server.playlists.addElement({
@@ -75,7 +79,7 @@ describe('Test services', function () {
const res = await server.services.getOEmbed({ oembedUrl })
const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts allow-popups allow-forms" ' +
`title="${video.name}" src="http://${server.host}/videos/embed/${video.uuid}${suffix.output}" ` +
`title="${video.name}" src="http://${server.host}/videos/embed/${video.shortUUID}${suffix.output}" ` +
'frameborder="0" allowfullscreen></iframe>'
const expectedThumbnailUrl = 'http://' + server.host + video.previewPath
@@ -99,7 +103,7 @@ describe('Test services', function () {
const res = await server.services.getOEmbed({ oembedUrl })
const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts allow-popups allow-forms" ' +
`title="${playlistDisplayName}" src="http://${server.host}/video-playlists/embed/${playlistUUID}${suffix.output}" ` +
`title="${playlistDisplayName}" src="http://${server.host}/video-playlists/embed/${playlistShortUUID}${suffix.output}" ` +
'frameborder="0" allowfullscreen></iframe>'
expect(res.body.html).to.equal(expectedHtml)
@@ -120,7 +124,7 @@ describe('Test services', function () {
const res = await server.services.getOEmbed({ oembedUrl })
const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts allow-popups allow-forms" ' +
`title="${video.name}" src="http://${server.host}/videos/embed/${video.uuid}${query}" ` +
`title="${video.name}" src="http://${server.host}/videos/embed/${video.shortUUID}${query}" ` +
'frameborder="0" allowfullscreen></iframe>'
expect(res.body.html).to.equal(expectedHtml)
@@ -135,7 +139,7 @@ describe('Test services', function () {
const res = await server.services.getOEmbed({ oembedUrl, format, maxHeight, maxWidth })
const expectedHtml = '<iframe width="50" height="50" sandbox="allow-same-origin allow-scripts allow-popups allow-forms" ' +
`title="${video.name}" src="http://${server.host}/videos/embed/${video.uuid}" ` +
`title="${video.name}" src="http://${server.host}/videos/embed/${video.shortUUID}" ` +
'frameborder="0" allowfullscreen></iframe>'
expect(res.body.html).to.equal(expectedHtml)