Skip to content

Commit

Permalink
Fix services tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Feb 13, 2025
1 parent 327360c commit a4d9c46
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/tests/src/api/server/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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({
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit a4d9c46

Please sign in to comment.