]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/cli/prune-storage.ts
Introduce bulk command
[github/Chocobozzz/PeerTube.git] / server / tests / cli / prune-storage.ts
index 5c9e023e1e23723f46207294ddbea9c27d473fb9..a0af09de8d7788ae774bb8b0a4de6f4d5ec82b3c 100644 (file)
@@ -2,7 +2,10 @@
 
 import 'mocha'
 import * as chai from 'chai'
-import { waitJobs } from '../../../shared/extra-utils/server/jobs'
+import { createFile, readdir } from 'fs-extra'
+import { join } from 'path'
+import { buildUUID } from '@server/helpers/uuid'
+import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
 import {
   buildServerDirectory,
   cleanupTests,
@@ -21,11 +24,8 @@ import {
   uploadVideo,
   wait
 } from '../../../shared/extra-utils'
+import { waitJobs } from '../../../shared/extra-utils/server/jobs'
 import { Account, VideoPlaylistPrivacy } from '../../../shared/models'
-import { createFile, readdir } from 'fs-extra'
-import { v4 as uuidv4 } from 'uuid'
-import { join } from 'path'
-import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
 
 const expect = chai.expect
 
@@ -131,8 +131,8 @@ describe('Test prune storage scripts', function () {
       {
         const base = buildServerDirectory(servers[0], 'videos')
 
-        const n1 = uuidv4() + '.mp4'
-        const n2 = uuidv4() + '.webm'
+        const n1 = buildUUID() + '.mp4'
+        const n2 = buildUUID() + '.webm'
 
         await createFile(join(base, n1))
         await createFile(join(base, n2))
@@ -143,8 +143,8 @@ describe('Test prune storage scripts', function () {
       {
         const base = buildServerDirectory(servers[0], 'torrents')
 
-        const n1 = uuidv4() + '-240.torrent'
-        const n2 = uuidv4() + '-480.torrent'
+        const n1 = buildUUID() + '-240.torrent'
+        const n2 = buildUUID() + '-480.torrent'
 
         await createFile(join(base, n1))
         await createFile(join(base, n2))
@@ -155,8 +155,8 @@ describe('Test prune storage scripts', function () {
       {
         const base = buildServerDirectory(servers[0], 'thumbnails')
 
-        const n1 = uuidv4() + '.jpg'
-        const n2 = uuidv4() + '.jpg'
+        const n1 = buildUUID() + '.jpg'
+        const n2 = buildUUID() + '.jpg'
 
         await createFile(join(base, n1))
         await createFile(join(base, n2))
@@ -167,8 +167,8 @@ describe('Test prune storage scripts', function () {
       {
         const base = buildServerDirectory(servers[0], 'previews')
 
-        const n1 = uuidv4() + '.jpg'
-        const n2 = uuidv4() + '.jpg'
+        const n1 = buildUUID() + '.jpg'
+        const n2 = buildUUID() + '.jpg'
 
         await createFile(join(base, n1))
         await createFile(join(base, n2))
@@ -179,8 +179,8 @@ describe('Test prune storage scripts', function () {
       {
         const base = buildServerDirectory(servers[0], 'avatars')
 
-        const n1 = uuidv4() + '.png'
-        const n2 = uuidv4() + '.jpg'
+        const n1 = buildUUID() + '.png'
+        const n2 = buildUUID() + '.jpg'
 
         await createFile(join(base, n1))
         await createFile(join(base, n2))