aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/playlists.ts
blob: fdd541d20e25417144ba77b0da09d1c4c23e8d54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { expect } from 'chai'
import { readdir } from 'fs-extra'
import { join } from 'path'
import { root } from '@shared/core-utils'

async function checkPlaylistFilesWereRemoved (
  playlistUUID: string,
  internalServerNumber: number,
  directories = [ 'thumbnails' ]
) {
  const testDirectory = 'test' + internalServerNumber

  for (const directory of directories) {
    const directoryPath = join(root(), testDirectory, directory)

    const files = await readdir(directoryPath)
    for (const file of files) {
      expect(file).to.not.contain(playlistUUID)
    }
  }
}

export {
  checkPlaylistFilesWereRemoved
}