/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai'
import { HttpStatusCode, VideoPlaylistCreateResult } from '@peertube/peertube-models'
import { PeerTubeServer, cleanupTests, makeGetRequest } from '@peertube/peertube-server-commands'
import { getWatchPlaylistBasePaths, getWatchVideoBasePaths, prepareClientTests } from '@tests/shared/client.js'
describe('Test oEmbed HTML tags', function () {
let servers: PeerTubeServer[]
let videoIds: (string | number)[] = []
let playlistName: string
let playlist: VideoPlaylistCreateResult
let playlistIds: (string | number)[] = []
before(async function () {
this.timeout(120000);
({ servers, playlistIds, videoIds, playlist, playlistName } = await prepareClientTests())
})
it('Should have valid oEmbed discovery tags for videos', async function () {
for (const basePath of getWatchVideoBasePaths()) {
for (const id of videoIds) {
const res = await makeGetRequest({
url: servers[0].url,
path: basePath + id,
accept: 'text/html',
expectedStatus: HttpStatusCode.OK_200
})
const expectedLink = ``
expect(res.text).to.contain(expectedLink)
}
}
})
it('Should have valid oEmbed discovery tags for a playlist', async function () {
for (const basePath of getWatchPlaylistBasePaths()) {
for (const id of playlistIds) {
const res = await makeGetRequest({
url: servers[0].url,
path: basePath + id,
accept: 'text/html',
expectedStatus: HttpStatusCode.OK_200
})
const expectedLink = ``
expect(res.text).to.contain(expectedLink)
}
}
})
after(async function () {
await cleanupTests(servers)
})
})