2021-07-08 08:54:39 -05:00
|
|
|
import { expect } from 'chai'
|
|
|
|
import { readdir } from 'fs-extra'
|
2022-10-04 03:53:00 -05:00
|
|
|
import { PeerTubeServer } from '@shared/server-commands'
|
2021-07-08 08:54:39 -05:00
|
|
|
|
|
|
|
async function checkPlaylistFilesWereRemoved (
|
|
|
|
playlistUUID: string,
|
2022-10-04 03:53:00 -05:00
|
|
|
server: PeerTubeServer,
|
2021-07-08 08:54:39 -05:00
|
|
|
directories = [ 'thumbnails' ]
|
|
|
|
) {
|
|
|
|
for (const directory of directories) {
|
2022-10-04 03:53:00 -05:00
|
|
|
const directoryPath = server.getDirectoryPath(directory)
|
2021-07-08 08:54:39 -05:00
|
|
|
|
|
|
|
const files = await readdir(directoryPath)
|
|
|
|
for (const file of files) {
|
|
|
|
expect(file).to.not.contain(playlistUUID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
checkPlaylistFilesWereRemoved
|
|
|
|
}
|