+ } while (video.state.id === state)
+}
+
+async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
+ const basePath = buildServerDirectory(server, 'streaming-playlists')
+ const hlsPath = join(basePath, 'hls', videoUUID)
+
+ if (resolutions.length === 0) {
+ const result = await pathExists(hlsPath)
+ expect(result).to.be.false
+
+ return
+ }
+
+ const files = await readdir(hlsPath)
+
+ // fragmented file and playlist per resolution + master playlist + segments sha256 json file
+ expect(files).to.have.lengthOf(resolutions.length * 2 + 2)
+
+ for (const resolution of resolutions) {
+ expect(files).to.contain(`${videoUUID}-${resolution}-fragmented.mp4`)
+ expect(files).to.contain(`${resolution}.m3u8`)
+ }
+
+ expect(files).to.contain('master.m3u8')
+ expect(files).to.contain('segments-sha256.json')