aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-hls.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-04 15:31:32 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitbd54ad1953ee0484ba90cf5f588f4c282048f368 (patch)
tree36e84ed92589a8775bc18e1b056f6b8de14bf2bb /server/tests/api/videos/video-hls.ts
parent68e70a745b2010cd0199864a2addd60d8f99c732 (diff)
downloadPeerTube-bd54ad1953ee0484ba90cf5f588f4c282048f368.tar.gz
PeerTube-bd54ad1953ee0484ba90cf5f588f4c282048f368.tar.zst
PeerTube-bd54ad1953ee0484ba90cf5f588f4c282048f368.zip
Add live notification tests
Diffstat (limited to 'server/tests/api/videos/video-hls.ts')
-rw-r--r--server/tests/api/videos/video-hls.ts13
1 files changed, 5 insertions, 8 deletions
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index 6555bc8b6..3a65cc1d2 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -1,9 +1,11 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import * as chai from 'chai'
4import 'mocha' 3import 'mocha'
4import * as chai from 'chai'
5import { join } from 'path'
5import { 6import {
6 checkDirectoryIsEmpty, 7 checkDirectoryIsEmpty,
8 checkResolutionsInMasterPlaylist,
7 checkSegmentHash, 9 checkSegmentHash,
8 checkTmpIsEmpty, 10 checkTmpIsEmpty,
9 cleanupTests, 11 cleanupTests,
@@ -23,7 +25,6 @@ import {
23} from '../../../../shared/extra-utils' 25} from '../../../../shared/extra-utils'
24import { VideoDetails } from '../../../../shared/models/videos' 26import { VideoDetails } from '../../../../shared/models/videos'
25import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type' 27import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type'
26import { join } from 'path'
27import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' 28import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
28 29
29const expect = chai.expect 30const expect = chai.expect
@@ -66,16 +67,12 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
66 } 67 }
67 68
68 { 69 {
69 const res = await getPlaylist(hlsPlaylist.playlistUrl) 70 await checkResolutionsInMasterPlaylist(hlsPlaylist.playlistUrl, resolutions)
70 71
72 const res = await getPlaylist(hlsPlaylist.playlistUrl)
71 const masterPlaylist = res.text 73 const masterPlaylist = res.text
72 74
73 for (const resolution of resolutions) { 75 for (const resolution of resolutions) {
74 const reg = new RegExp(
75 '#EXT-X-STREAM-INF:BANDWIDTH=\\d+,RESOLUTION=\\d+x' + resolution + ',FRAME-RATE=\\d+,CODECS="avc1.64001f,mp4a.40.2"'
76 )
77
78 expect(masterPlaylist).to.match(reg)
79 expect(masterPlaylist).to.contain(`${resolution}.m3u8`) 76 expect(masterPlaylist).to.contain(`${resolution}.m3u8`)
80 expect(masterPlaylist).to.contain(`${resolution}.m3u8`) 77 expect(masterPlaylist).to.contain(`${resolution}.m3u8`)
81 } 78 }