From c5d31dba56d669c0df0209761c43c5a6ac7cec4a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 28 Dec 2017 13:59:22 +0100 Subject: [PATCH] Tests directories refractor --- server/tests/activitypub.ts | 4 +-- server/tests/api/check-params/services.ts | 2 +- .../tests/api/check-params/video-comments.ts | 2 +- server/tests/api/index-fast.ts | 18 +++++------ server/tests/api/index-slow.ts | 10 +++---- server/tests/api/{ => server}/config.ts | 2 +- server/tests/api/{ => server}/follows.ts | 19 +++++++----- server/tests/api/{ => server}/jobs.ts | 12 ++++---- server/tests/api/{ => users}/users.ts | 10 +++---- .../api/{ => videos}/multiple-servers.ts | 13 ++++---- server/tests/api/{ => videos}/services.ts | 4 +-- .../tests/api/{ => videos}/single-server.ts | 4 +-- server/tests/api/{ => videos}/video-abuse.ts | 4 +-- .../video-blacklist-management.ts | 4 +-- .../tests/api/{ => videos}/video-blacklist.ts | 4 +-- .../tests/api/{ => videos}/video-channels.ts | 4 +-- .../tests/api/{ => videos}/video-comments.ts | 9 ++++-- .../api/{ => videos}/video-description.ts | 4 +-- .../tests/api/{ => videos}/video-privacy.ts | 12 ++++---- .../api/{ => videos}/video-transcoder.ts | 2 +- server/tests/utils/{ => cli}/cli.ts | 2 +- server/tests/utils/index.ts | 30 +++++++++---------- server/tests/utils/{ => miscs}/miscs.ts | 0 server/tests/utils/{ => requests}/requests.ts | 0 .../tests/utils/{ => server}/activitypub.ts | 0 server/tests/utils/{ => server}/clients.ts | 0 server/tests/utils/{ => server}/config.ts | 0 server/tests/utils/{ => server}/follows.ts | 2 +- server/tests/utils/{ => server}/jobs.ts | 0 server/tests/utils/{ => server}/servers.ts | 0 server/tests/utils/{ => users}/login.ts | 2 +- server/tests/utils/{ => users}/users.ts | 2 +- server/tests/utils/{ => videos}/services.ts | 0 .../tests/utils/{ => videos}/video-abuses.ts | 0 .../utils/{ => videos}/video-blacklist.ts | 0 .../utils/{ => videos}/video-channels.ts | 0 .../utils/{ => videos}/video-comments.ts | 0 server/tests/utils/{ => videos}/videos.ts | 12 +++----- 38 files changed, 98 insertions(+), 95 deletions(-) rename server/tests/api/{ => server}/config.ts (97%) rename server/tests/api/{ => server}/follows.ts (94%) rename server/tests/api/{ => server}/jobs.ts (82%) rename server/tests/api/{ => users}/users.ts (98%) rename server/tests/api/{ => videos}/multiple-servers.ts (98%) rename server/tests/api/{ => videos}/services.ts (97%) rename server/tests/api/{ => videos}/single-server.ts (99%) rename server/tests/api/{ => videos}/video-abuse.ts (98%) rename server/tests/api/{ => videos}/video-blacklist-management.ts (98%) rename server/tests/api/{ => videos}/video-blacklist.ts (96%) rename server/tests/api/{ => videos}/video-channels.ts (98%) rename server/tests/api/{ => videos}/video-comments.ts (94%) rename server/tests/api/{ => videos}/video-description.ts (97%) rename server/tests/api/{ => videos}/video-privacy.ts (93%) rename server/tests/api/{ => videos}/video-transcoder.ts (98%) rename server/tests/utils/{ => cli}/cli.ts (90%) rename server/tests/utils/{ => miscs}/miscs.ts (100%) rename server/tests/utils/{ => requests}/requests.ts (100%) rename server/tests/utils/{ => server}/activitypub.ts (100%) rename server/tests/utils/{ => server}/clients.ts (100%) rename server/tests/utils/{ => server}/config.ts (100%) rename server/tests/utils/{ => server}/follows.ts (98%) rename server/tests/utils/{ => server}/jobs.ts (100%) rename server/tests/utils/{ => server}/servers.ts (100%) rename server/tests/utils/{ => users}/login.ts (96%) rename server/tests/utils/{ => users}/users.ts (98%) rename server/tests/utils/{ => videos}/services.ts (100%) rename server/tests/utils/{ => videos}/video-abuses.ts (100%) rename server/tests/utils/{ => videos}/video-blacklist.ts (100%) rename server/tests/utils/{ => videos}/video-channels.ts (100%) rename server/tests/utils/{ => videos}/video-comments.ts (100%) rename server/tests/utils/{ => videos}/videos.ts (97%) diff --git a/server/tests/activitypub.ts b/server/tests/activitypub.ts index 333e02e84..94615c63f 100644 --- a/server/tests/activitypub.ts +++ b/server/tests/activitypub.ts @@ -2,9 +2,7 @@ import * as chai from 'chai' import 'mocha' -import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from './utils' -import { runServer } from './utils/servers' -import { makeActivityPubGetRequest } from './utils/activitypub' +import { flushTests, killallServers, makeActivityPubGetRequest, runServer, ServerInfo, setAccessTokensToServers } from './utils' const expect = chai.expect diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts index 780254df5..f82520574 100644 --- a/server/tests/api/check-params/services.ts +++ b/server/tests/api/check-params/services.ts @@ -9,7 +9,7 @@ import { setAccessTokensToServers, killallServers } from '../../utils' -import { getVideosList, uploadVideo } from '../../utils/videos' +import { getVideosList, uploadVideo } from '../../utils/videos/videos' describe('Test services API validators', function () { let server diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index e8d7ddf38..f3832bd2c 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts @@ -3,7 +3,7 @@ import 'mocha' import * as request from 'supertest' import { flushTests, killallServers, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils' -import { addVideoCommentThread } from '../../utils/video-comments' +import { addVideoCommentThread } from '../../utils/videos/video-comments' describe('Test video comments API validator', function () { let pathThread: string diff --git a/server/tests/api/index-fast.ts b/server/tests/api/index-fast.ts index 35b414383..e591d0fd2 100644 --- a/server/tests/api/index-fast.ts +++ b/server/tests/api/index-fast.ts @@ -1,11 +1,11 @@ // Order of the tests we want to execute -import './config' +import './server/config' import './check-params' -import './users' -import './single-server' -import './video-abuse' -import './video-blacklist' -import './video-blacklist-management' -import './video-description' -import './video-privacy' -import './services' +import './users/users' +import './videos/single-server' +import './videos/video-abuse' +import './videos/video-blacklist' +import './videos/video-blacklist-management' +import './videos/video-description' +import './videos/video-privacy' +import './videos/services' diff --git a/server/tests/api/index-slow.ts b/server/tests/api/index-slow.ts index b525d6f01..23b6526c7 100644 --- a/server/tests/api/index-slow.ts +++ b/server/tests/api/index-slow.ts @@ -1,7 +1,7 @@ // Order of the tests we want to execute // import './multiple-servers' -import './video-transcoder' -import './multiple-servers' -import './follows' -import './jobs' -import './video-comments' +import './videos/video-transcoder' +import './videos/multiple-servers' +import './server/follows' +import './server/jobs' +import './videos/video-comments' diff --git a/server/tests/api/config.ts b/server/tests/api/server/config.ts similarity index 97% rename from server/tests/api/config.ts rename to server/tests/api/server/config.ts index 61ae57977..e8846c8db 100644 --- a/server/tests/api/config.ts +++ b/server/tests/api/server/config.ts @@ -9,7 +9,7 @@ import { flushTests, runServer, registerUser -} from '../utils' +} from '../../utils/index' describe('Test config', function () { let server = null diff --git a/server/tests/api/follows.ts b/server/tests/api/server/follows.ts similarity index 94% rename from server/tests/api/follows.ts rename to server/tests/api/server/follows.ts index 2ffa426a0..f77c0c67c 100644 --- a/server/tests/api/follows.ts +++ b/server/tests/api/server/follows.ts @@ -2,18 +2,21 @@ import * as chai from 'chai' import 'mocha' -import { VideoComment, VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' +import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' import { flushAndRunMultipleServers, flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, wait -} from '../utils' -import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../utils/follows' -import { getUserAccessToken } from '../utils/login' -import { dateIsValid, webtorrentAdd } from '../utils/miscs' -import { createUser } from '../utils/users' -import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments } from '../utils/video-comments' -import { getVideo, rateVideo, testVideoImage } from '../utils/videos' +} from '../../utils/index' +import { dateIsValid, webtorrentAdd } from '../../utils/miscs/miscs' +import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../../utils/server/follows' +import { getUserAccessToken } from '../../utils/users/login' +import { createUser } from '../../utils/users/users' +import { + addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, + getVideoThreadComments +} from '../../utils/videos/video-comments' +import { getVideo, rateVideo, testVideoImage } from '../../utils/videos/videos' const expect = chai.expect diff --git a/server/tests/api/jobs.ts b/server/tests/api/server/jobs.ts similarity index 82% rename from server/tests/api/jobs.ts rename to server/tests/api/server/jobs.ts index 4d9b61392..2e17e71a4 100644 --- a/server/tests/api/jobs.ts +++ b/server/tests/api/server/jobs.ts @@ -2,12 +2,12 @@ import * as chai from 'chai' import 'mocha' -import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../utils' -import { doubleFollow } from '../utils/follows' -import { getJobsList, getJobsListPaginationAndSort } from '../utils/jobs' -import { flushAndRunMultipleServers } from '../utils/servers' -import { uploadVideo } from '../utils/videos' -import { dateIsValid } from '../utils/miscs' +import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../../utils/index' +import { doubleFollow } from '../../utils/server/follows' +import { getJobsList, getJobsListPaginationAndSort } from '../../utils/server/jobs' +import { flushAndRunMultipleServers } from '../../utils/server/servers' +import { uploadVideo } from '../../utils/videos/videos' +import { dateIsValid } from '../../utils/miscs/miscs' const expect = chai.expect diff --git a/server/tests/api/users.ts b/server/tests/api/users/users.ts similarity index 98% rename from server/tests/api/users.ts rename to server/tests/api/users/users.ts index 67e4cc8c6..2e3a0b94f 100644 --- a/server/tests/api/users.ts +++ b/server/tests/api/users/users.ts @@ -2,7 +2,7 @@ import * as chai from 'chai' import 'mocha' -import { UserRole } from '../../../shared' +import { UserRole } from '../../../../shared/index' import { createUser, flushTests, @@ -26,10 +26,10 @@ import { updateMyUser, updateUser, uploadVideo -} from '../utils' -import { follow } from '../utils/follows' -import { getMyVideos } from '../utils/videos' -import { setAccessTokensToServers } from '../utils/login' +} from '../../utils/index' +import { follow } from '../../utils/server/follows' +import { getMyVideos } from '../../utils/videos/videos' +import { setAccessTokensToServers } from '../../utils/users/login' const expect = chai.expect diff --git a/server/tests/api/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts similarity index 98% rename from server/tests/api/multiple-servers.ts rename to server/tests/api/videos/multiple-servers.ts index 06274d4cc..84f730a8e 100644 --- a/server/tests/api/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -4,16 +4,19 @@ import * as chai from 'chai' import 'mocha' import { join } from 'path' import * as request from 'supertest' -import { VideoComment, VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' +import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' import { addVideoChannel, dateIsValid, doubleFollow, flushAndRunMultipleServers, flushTests, getUserAccessToken, getVideo, getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testVideoImage, updateVideo, uploadVideo, wait, webtorrentAdd -} from '../utils' -import { createUser } from '../utils/users' -import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments } from '../utils/video-comments' -import { viewVideo } from '../utils/videos' +} from '../../utils/index' +import { createUser } from '../../utils/users/users' +import { + addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, + getVideoThreadComments +} from '../../utils/videos/video-comments' +import { viewVideo } from '../../utils/videos/videos' const expect = chai.expect diff --git a/server/tests/api/services.ts b/server/tests/api/videos/services.ts similarity index 97% rename from server/tests/api/services.ts rename to server/tests/api/videos/services.ts index 4d480c305..1cda464d9 100644 --- a/server/tests/api/services.ts +++ b/server/tests/api/videos/services.ts @@ -12,8 +12,8 @@ import { setAccessTokensToServers, killallServers, getOEmbed -} from '../utils' -import { runServer } from '../utils/servers' +} from '../../utils/index' +import { runServer } from '../../utils/server/servers' describe('Test services', function () { let server: ServerInfo = null diff --git a/server/tests/api/single-server.ts b/server/tests/api/videos/single-server.ts similarity index 99% rename from server/tests/api/single-server.ts rename to server/tests/api/videos/single-server.ts index 7f4351f5e..02723654d 100644 --- a/server/tests/api/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -30,8 +30,8 @@ import { uploadVideo, wait, webtorrentAdd -} from '../utils' -import { viewVideo } from '../utils/videos' +} from '../../utils/index' +import { viewVideo } from '../../utils/videos/videos' const expect = chai.expect diff --git a/server/tests/api/video-abuse.ts b/server/tests/api/videos/video-abuse.ts similarity index 98% rename from server/tests/api/video-abuse.ts rename to server/tests/api/videos/video-abuse.ts index 4a0b6b504..3fcf5d8c7 100644 --- a/server/tests/api/video-abuse.ts +++ b/server/tests/api/videos/video-abuse.ts @@ -13,8 +13,8 @@ import { setAccessTokensToServers, uploadVideo, wait -} from '../utils' -import { doubleFollow } from '../utils/follows' +} from '../../utils/index' +import { doubleFollow } from '../../utils/server/follows' const expect = chai.expect diff --git a/server/tests/api/video-blacklist-management.ts b/server/tests/api/videos/video-blacklist-management.ts similarity index 98% rename from server/tests/api/video-blacklist-management.ts rename to server/tests/api/videos/video-blacklist-management.ts index 0c636e094..db79784c2 100644 --- a/server/tests/api/video-blacklist-management.ts +++ b/server/tests/api/videos/video-blacklist-management.ts @@ -16,8 +16,8 @@ import { setAccessTokensToServers, uploadVideo, wait -} from '../utils' -import { doubleFollow } from '../utils/follows' +} from '../../utils/index' +import { doubleFollow } from '../../utils/server/follows' const expect = chai.expect const orderBy = lodash.orderBy diff --git a/server/tests/api/video-blacklist.ts b/server/tests/api/videos/video-blacklist.ts similarity index 96% rename from server/tests/api/video-blacklist.ts rename to server/tests/api/videos/video-blacklist.ts index 3afd8c510..d1cefa5d7 100644 --- a/server/tests/api/video-blacklist.ts +++ b/server/tests/api/videos/video-blacklist.ts @@ -13,8 +13,8 @@ import { setAccessTokensToServers, uploadVideo, wait -} from '../utils' -import { doubleFollow } from '../utils/follows' +} from '../../utils/index' +import { doubleFollow } from '../../utils/server/follows' const expect = chai.expect diff --git a/server/tests/api/video-channels.ts b/server/tests/api/videos/video-channels.ts similarity index 98% rename from server/tests/api/video-channels.ts rename to server/tests/api/videos/video-channels.ts index 2d8efb320..454a96da6 100644 --- a/server/tests/api/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts @@ -17,8 +17,8 @@ import { updateVideoChannel, deleteVideoChannel, getVideoChannel -} from '../utils' -import { User } from '../../../shared' +} from '../../utils/index' +import { User } from '../../../../shared/index' describe('Test a video channels', function () { let server: ServerInfo diff --git a/server/tests/api/video-comments.ts b/server/tests/api/videos/video-comments.ts similarity index 94% rename from server/tests/api/video-comments.ts rename to server/tests/api/videos/video-comments.ts index f05ca5e81..3b6578f04 100644 --- a/server/tests/api/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts @@ -2,9 +2,12 @@ import * as chai from 'chai' import 'mocha' -import { VideoComment, VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' -import { dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../utils' -import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments } from '../utils/video-comments' +import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' +import { dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index' +import { + addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, + getVideoThreadComments +} from '../../utils/videos/video-comments' const expect = chai.expect diff --git a/server/tests/api/video-description.ts b/server/tests/api/videos/video-description.ts similarity index 97% rename from server/tests/api/video-description.ts rename to server/tests/api/videos/video-description.ts index 7ad1c63ae..c2985194c 100644 --- a/server/tests/api/video-description.ts +++ b/server/tests/api/videos/video-description.ts @@ -14,8 +14,8 @@ import { updateVideo, uploadVideo, wait -} from '../utils' -import { doubleFollow } from '../utils/follows' +} from '../../utils/index' +import { doubleFollow } from '../../utils/server/follows' const expect = chai.expect diff --git a/server/tests/api/video-privacy.ts b/server/tests/api/videos/video-privacy.ts similarity index 93% rename from server/tests/api/video-privacy.ts rename to server/tests/api/videos/video-privacy.ts index 26847efce..de709f8f1 100644 --- a/server/tests/api/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts @@ -2,7 +2,7 @@ import * as chai from 'chai' import 'mocha' -import { VideoPrivacy } from '../../../shared/models/videos/video-privacy.enum' +import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' import { flushAndRunMultipleServers, flushTests, @@ -12,11 +12,11 @@ import { setAccessTokensToServers, uploadVideo, wait -} from '../utils' -import { doubleFollow } from '../utils/follows' -import { getUserAccessToken } from '../utils/login' -import { createUser } from '../utils/users' -import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../utils/videos' +} from '../../utils/index' +import { doubleFollow } from '../../utils/server/follows' +import { getUserAccessToken } from '../../utils/users/login' +import { createUser } from '../../utils/users/users' +import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../utils/videos/videos' const expect = chai.expect diff --git a/server/tests/api/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts similarity index 98% rename from server/tests/api/video-transcoder.ts rename to server/tests/api/videos/video-transcoder.ts index 9a6e91b76..27927a594 100644 --- a/server/tests/api/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts @@ -15,7 +15,7 @@ import { killallServers, webtorrentAdd, getVideo -} from '../utils' +} from '../../utils/index' describe('Test video transcoding', function () { let servers: ServerInfo[] = [] diff --git a/server/tests/utils/cli.ts b/server/tests/utils/cli/cli.ts similarity index 90% rename from server/tests/utils/cli.ts rename to server/tests/utils/cli/cli.ts index 4098fdf6f..54d05e9c6 100644 --- a/server/tests/utils/cli.ts +++ b/server/tests/utils/cli/cli.ts @@ -1,6 +1,6 @@ import { exec } from 'child_process' -import { ServerInfo } from './servers' +import { ServerInfo } from '../server/servers' function getEnvCli (server?: ServerInfo) { return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}` diff --git a/server/tests/utils/index.ts b/server/tests/utils/index.ts index b918ee83d..d7789e517 100644 --- a/server/tests/utils/index.ts +++ b/server/tests/utils/index.ts @@ -1,15 +1,15 @@ -export * from './activitypub' -export * from './cli' -export * from './clients' -export * from './config' -export * from './login' -export * from './miscs' -export * from './follows' -export * from './requests' -export * from './servers' -export * from './services' -export * from './users' -export * from './video-abuses' -export * from './video-blacklist' -export * from './video-channels' -export * from './videos' +export * from './server/activitypub' +export * from './cli/cli' +export * from './server/clients' +export * from './server/config' +export * from './users/login' +export * from './miscs/miscs' +export * from './server/follows' +export * from './requests/requests' +export * from './server/servers' +export * from './videos/services' +export * from './users/users' +export * from './videos/video-abuses' +export * from './videos/video-blacklist' +export * from './videos/video-channels' +export * from './videos/videos' diff --git a/server/tests/utils/miscs.ts b/server/tests/utils/miscs/miscs.ts similarity index 100% rename from server/tests/utils/miscs.ts rename to server/tests/utils/miscs/miscs.ts diff --git a/server/tests/utils/requests.ts b/server/tests/utils/requests/requests.ts similarity index 100% rename from server/tests/utils/requests.ts rename to server/tests/utils/requests/requests.ts diff --git a/server/tests/utils/activitypub.ts b/server/tests/utils/server/activitypub.ts similarity index 100% rename from server/tests/utils/activitypub.ts rename to server/tests/utils/server/activitypub.ts diff --git a/server/tests/utils/clients.ts b/server/tests/utils/server/clients.ts similarity index 100% rename from server/tests/utils/clients.ts rename to server/tests/utils/server/clients.ts diff --git a/server/tests/utils/config.ts b/server/tests/utils/server/config.ts similarity index 100% rename from server/tests/utils/config.ts rename to server/tests/utils/server/config.ts diff --git a/server/tests/utils/follows.ts b/server/tests/utils/server/follows.ts similarity index 98% rename from server/tests/utils/follows.ts rename to server/tests/utils/server/follows.ts index a9f798bcb..82e89175c 100644 --- a/server/tests/utils/follows.ts +++ b/server/tests/utils/server/follows.ts @@ -1,5 +1,5 @@ import * as request from 'supertest' -import { wait } from './miscs' +import { wait } from '../miscs/miscs' import { ServerInfo } from './servers' function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string) { diff --git a/server/tests/utils/jobs.ts b/server/tests/utils/server/jobs.ts similarity index 100% rename from server/tests/utils/jobs.ts rename to server/tests/utils/server/jobs.ts diff --git a/server/tests/utils/servers.ts b/server/tests/utils/server/servers.ts similarity index 100% rename from server/tests/utils/servers.ts rename to server/tests/utils/server/servers.ts diff --git a/server/tests/utils/login.ts b/server/tests/utils/users/login.ts similarity index 96% rename from server/tests/utils/login.ts rename to server/tests/utils/users/login.ts index 22d37c46f..855c4828d 100644 --- a/server/tests/utils/login.ts +++ b/server/tests/utils/users/login.ts @@ -1,6 +1,6 @@ import * as request from 'supertest' -import { ServerInfo } from './servers' +import { ServerInfo } from '../server/servers' type Client = { id: string, secret: string } type User = { username: string, password: string } diff --git a/server/tests/utils/users.ts b/server/tests/utils/users/users.ts similarity index 98% rename from server/tests/utils/users.ts rename to server/tests/utils/users/users.ts index a37d84ab4..bd8d7ab04 100644 --- a/server/tests/utils/users.ts +++ b/server/tests/utils/users/users.ts @@ -1,6 +1,6 @@ import * as request from 'supertest' -import { UserRole } from '../../../shared' +import { UserRole } from '../../../../shared/index' function createUser ( url: string, diff --git a/server/tests/utils/services.ts b/server/tests/utils/videos/services.ts similarity index 100% rename from server/tests/utils/services.ts rename to server/tests/utils/videos/services.ts diff --git a/server/tests/utils/video-abuses.ts b/server/tests/utils/videos/video-abuses.ts similarity index 100% rename from server/tests/utils/video-abuses.ts rename to server/tests/utils/videos/video-abuses.ts diff --git a/server/tests/utils/video-blacklist.ts b/server/tests/utils/videos/video-blacklist.ts similarity index 100% rename from server/tests/utils/video-blacklist.ts rename to server/tests/utils/videos/video-blacklist.ts diff --git a/server/tests/utils/video-channels.ts b/server/tests/utils/videos/video-channels.ts similarity index 100% rename from server/tests/utils/video-channels.ts rename to server/tests/utils/videos/video-channels.ts diff --git a/server/tests/utils/video-comments.ts b/server/tests/utils/videos/video-comments.ts similarity index 100% rename from server/tests/utils/video-comments.ts rename to server/tests/utils/videos/video-comments.ts diff --git a/server/tests/utils/videos.ts b/server/tests/utils/videos/videos.ts similarity index 97% rename from server/tests/utils/videos.ts rename to server/tests/utils/videos/videos.ts index fb758cf29..6de1b8c92 100644 --- a/server/tests/utils/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -1,13 +1,9 @@ import { readFile } from 'fs' -import * as request from 'supertest' -import { join, isAbsolute } from 'path' import * as parseTorrent from 'parse-torrent' - -import { makeGetRequest } from './requests' -import { readFilePromise } from './miscs' -import { ServerInfo } from './servers' -import { getMyUserInformation } from './users' -import { VideoPrivacy } from '../../../shared' +import { isAbsolute, join } from 'path' +import * as request from 'supertest' +import { getMyUserInformation, makeGetRequest, readFilePromise, ServerInfo } from '../' +import { VideoPrivacy } from '../../../../shared/models/videos' type VideoAttributes = { name?: string