From 06aad80165d09a8863ab8103149a8ff518b10641 Mon Sep 17 00:00:00 2001 From: lutangar Date: Tue, 2 Nov 2021 19:11:20 +0100 Subject: chore(refactor): remove shared folder dependencies to the server Many files from the `shared` folder were importing files from the `server` folder. When attempting to use Typescript project references to describe dependencies, it highlighted a circular dependency beetween `shared` <-> `server`. The Typescript project forbid such usages. Using project references greatly improve performance by rebuilding only the updated project and not all source files. > see https://www.typescriptlang.org/docs/handbook/project-references.html --- server/tests/api/activitypub/security.ts | 2 +- server/tests/api/notifications/moderation-notifications.ts | 2 +- server/tests/api/notifications/user-notifications.ts | 2 +- server/tests/api/server/follows.ts | 2 +- server/tests/api/server/handle-down.ts | 2 +- server/tests/api/videos/multiple-servers.ts | 2 +- server/tests/api/videos/single-server.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index 94d946563..2700cff13 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts @@ -7,7 +7,7 @@ import { buildDigest } from '@server/helpers/peertube-crypto' import { HTTP_SIGNATURE } from '@server/initializers/constants' import { buildGlobalHeaders } from '@server/lib/job-queue/handlers/utils/activitypub-http-utils' import { buildAbsoluteFixturePath, cleanupTests, createMultipleServers, killallServers, PeerTubeServer, wait } from '@shared/extra-utils' -import { makeFollowRequest, makePOSTAPRequest } from '@shared/extra-utils/requests/activitypub' +import { makeFollowRequest, makePOSTAPRequest } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts index 81ce8061b..6d8e5359b 100644 --- a/server/tests/api/notifications/moderation-notifications.ts +++ b/server/tests/api/notifications/moderation-notifications.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { buildUUID } from '@server/helpers/uuid' +import { buildUUID } from '@shared/core-utils/uuid' import { checkAbuseStateChange, checkAutoInstanceFollowing, diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts index 9af20843e..6db0347cc 100644 --- a/server/tests/api/notifications/user-notifications.ts +++ b/server/tests/api/notifications/user-notifications.ts @@ -2,7 +2,7 @@ import 'mocha' import * as chai from 'chai' -import { buildUUID } from '@server/helpers/uuid' +import { buildUUID } from '@shared/core-utils/uuid' import { CheckerBaseParams, checkMyVideoImportIsFinished, diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 832ba561a..748f4cd35 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts @@ -4,7 +4,6 @@ import 'mocha' import * as chai from 'chai' import { cleanupTests, - completeVideoCheck, createMultipleServers, dateIsValid, expectAccountFollows, @@ -15,6 +14,7 @@ import { waitJobs } from '@shared/extra-utils' import { VideoCreateResult, VideoPrivacy } from '@shared/models' +import { completeVideoCheck } from '@server/tests/shared/video' const expect = chai.expect diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index fa1da8fe0..2d059c0ed 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts @@ -5,7 +5,6 @@ import * as chai from 'chai' import { cleanupTests, CommentsCommand, - completeVideoCheck, createMultipleServers, killallServers, PeerTubeServer, @@ -14,6 +13,7 @@ import { waitJobs } from '@shared/extra-utils' import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' +import { completeVideoCheck } from '@server/tests/shared/video' const expect = chai.expect diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index c6c279064..9e7b39cfa 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -8,7 +8,6 @@ import { checkTmpIsEmpty, checkVideoFilesWereRemoved, cleanupTests, - completeVideoCheck, createMultipleServers, dateIsValid, doubleFollow, @@ -21,6 +20,7 @@ import { webtorrentAdd } from '@shared/extra-utils' import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' +import { completeVideoCheck } from '@server/tests/shared/video' const expect = chai.expect diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index a0e4a156c..100067f18 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -5,7 +5,6 @@ import * as chai from 'chai' import { checkVideoFilesWereRemoved, cleanupTests, - completeVideoCheck, createSingleServer, PeerTubeServer, setAccessTokensToServers, @@ -13,6 +12,7 @@ import { wait } from '@shared/extra-utils' import { Video, VideoPrivacy } from '@shared/models' +import { completeVideoCheck } from '@server/tests/shared/video' const expect = chai.expect -- cgit v1.2.3