diff --git a/server/tests/helpers/journal-links.ts b/server/tests/helpers/journal-links.ts deleted file mode 100644 index 3fccc7542..000000000 --- a/server/tests/helpers/journal-links.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { TripJournalLinkService } from '../../src/nest/journey/trip-journal-link.service'; - -/** - * TripJournalLinkService for the suites that hand-build TripMembersService: - * leaving a trip only has to drop the member from a linked journal, and what - * that does to the journal's access is pinned by the TJL integration tests - * against the real service. - */ -export function journalLinksStub( - dropMember: TripJournalLinkService['dropMember'] = async () => {}, -): TripJournalLinkService { - return { dropMember } as unknown as TripJournalLinkService; -} diff --git a/server/tests/helpers/journey-share-repos.ts b/server/tests/helpers/journey-share-repos.ts index a8d29ca69..1757b44a8 100644 --- a/server/tests/helpers/journey-share-repos.ts +++ b/server/tests/helpers/journey-share-repos.ts @@ -2,6 +2,7 @@ import { JourneyBooks } from '../../src/db/entities/JourneyBooks.entity'; import { JourneyShareTokens } from '../../src/db/entities/JourneyShareTokens.entity'; import type { JourneyBooksRepository } from '../../src/db/repositories/JourneyBooks.repository'; import type { JourneyShareTokensRepository } from '../../src/db/repositories/JourneyShareTokens.repository'; +import type { TripJournalLinkService } from '../../src/nest/journey/trip-journal-link.service'; import { sharedTestOrm } from './test-uow'; import type Database from 'better-sqlite3'; @@ -25,3 +26,15 @@ export function createTestJourneyShareTokensRepo(db: Database.Database): Promise export function createTestJourneyBooksRepo(db: Database.Database): Promise { return sharedTestOrm(db).then((t) => t.repo(JourneyBooks)); } + +/** + * TripJournalLinkService for the suites that hand-build TripMembersService: + * leaving a trip only has to drop the member from a linked journal, and what + * that does to the journal's access is pinned by the TJL integration tests + * against the real service. + */ +export function journalLinksStub( + dropMember: TripJournalLinkService['dropMember'] = async () => {}, +): TripJournalLinkService { + return { dropMember } as unknown as TripJournalLinkService; +} diff --git a/server/tests/helpers/plugin-host.ts b/server/tests/helpers/plugin-host.ts index cc6e49134..5561ef2ed 100644 --- a/server/tests/helpers/plugin-host.ts +++ b/server/tests/helpers/plugin-host.ts @@ -111,7 +111,6 @@ import { } from './collab-repos'; import { createTestTripFilesRepo, createTestFileLinksRepo, createTestBudgetItemsRepo } from './files-repos'; import { noGoogleQuota } from './google-quota'; -import { journalLinksStub } from './journal-links'; import { createTestJourneysRepo, createTestJourneyContributorsRepo, @@ -120,6 +119,7 @@ import { createTestJourneyPhotosRepo, createTestJourneyEntryPhotosRepo, } from './journey-repos'; +import { journalLinksStub } from './journey-share-repos'; import { createTestJourneyShareTokensRepo } from './journey-share-repos'; import { buildMapsService } from './maps-service'; import { makeNotificationsService } from './notifications'; diff --git a/server/tests/unit/nest/budget.service.db.test.ts b/server/tests/unit/nest/budget.service.db.test.ts index 5f8da5b45..a620b2618 100644 --- a/server/tests/unit/nest/budget.service.db.test.ts +++ b/server/tests/unit/nest/budget.service.db.test.ts @@ -56,13 +56,12 @@ import { CollabService } from '../../../src/nest/collab/collab.service'; import { VacayService } from '../../../src/nest/vacay/vacay.service'; import { QueryHelpersService } from '../../../src/nest/query-helpers/query-helpers.service'; import { notificationsStub } from '../../helpers/notifications'; -import { journalLinksStub } from '../../helpers/journal-links'; import { createTestUnitOfWork, createTestAppSettingsRepo, createTestUsersRepo, sharedTestOrm, createTestTripsRepo, createTestTripMembersRepo } from '../../helpers/test-uow'; import { budgetRepoArgs, createTestBudgetItemMembersRepo, createTestBudgetItemPayersRepo, createTestBudgetSettlementsRepo } from '../../helpers/budget-repos'; import { createTestShareTokensRepo, createTestPluginsRepo, createTestPluginUserErasureQueueRepo } from '../../helpers/share-repos'; import { createTestBudgetItemsRepo } from '../../helpers/files-repos'; import { createTestJourneysRepo, createTestJourneyEntriesRepo, createTestJourneyContributorsRepo } from '../../helpers/journey-repos'; -import { createTestJourneyShareTokensRepo } from '../../helpers/journey-share-repos'; +import { createTestJourneyShareTokensRepo, journalLinksStub } from '../../helpers/journey-share-repos'; import { BudgetItemMembers } from '../../../src/db/entities/BudgetItemMembers.entity'; import { MaintenanceRepository } from '../../../src/db/repositories/MaintenanceRepository'; import { BudgetCategoryOrder } from '../../../src/db/entities/BudgetCategoryOrder.entity'; @@ -161,8 +160,7 @@ beforeAll(async () => { new UserCleanupService(new MaintenanceRepository(dbsEm!), budget, await createTestUnitOfWork(testDb), await createTestUsersRepo(testDb), await createTestTripMembersRepo(testDb), await createTestBudgetItemsRepo(testDb), await createTestBudgetSettlementsRepo(testDb), await createTestJourneyShareTokensRepo(testDb), await createTestJourneysRepo(testDb), await createTestJourneyEntriesRepo(testDb), await createTestJourneyContributorsRepo(testDb), await createTestShareTokensRepo(testDb), await createTestPluginsRepo(testDb), await createTestPluginUserErasureQueueRepo(testDb)), new PermissionsService(await createTestAppSettingsRepo(testDb), await createTestUnitOfWork(testDb)), new RealtimeService(), - notificationsStub(), - journalLinksStub(), + notificationsStub(), journalLinksStub(), await createTestUnitOfWork(testDb), await createTestTripsRepo(testDb), await createTestTripMembersRepo(testDb), diff --git a/server/tests/unit/nest/trip-members.service.test.ts b/server/tests/unit/nest/trip-members.service.test.ts index 96f8da42d..e92f2f08f 100644 --- a/server/tests/unit/nest/trip-members.service.test.ts +++ b/server/tests/unit/nest/trip-members.service.test.ts @@ -37,12 +37,12 @@ import { countRows, deleteRows, findRow, findRows, insertRow, updateRows } from import { readUser } from '../../helpers/factories/users'; import { FakeRealtimeService } from '../../helpers/fake-realtime'; import { createTestBudgetItemsRepo } from '../../helpers/files-repos'; -import { journalLinksStub } from '../../helpers/journal-links'; import { createTestJourneysRepo, createTestJourneyEntriesRepo, createTestJourneyContributorsRepo, } from '../../helpers/journey-repos'; +import { journalLinksStub } from '../../helpers/journey-share-repos'; import { createTestJourneyShareTokensRepo } from '../../helpers/journey-share-repos'; import { notificationsStub } from '../../helpers/notifications'; import { diff --git a/server/tests/unit/nest/trip-read-model.service.test.ts b/server/tests/unit/nest/trip-read-model.service.test.ts index 173768097..45dfb42c3 100644 --- a/server/tests/unit/nest/trip-read-model.service.test.ts +++ b/server/tests/unit/nest/trip-read-model.service.test.ts @@ -57,7 +57,6 @@ import { insertRow, updateRows } from '../../helpers/factories/rows'; import { FakeRealtimeService } from '../../helpers/fake-realtime'; import { createTestTripFilesRepo, createTestFileLinksRepo, createTestBudgetItemsRepo } from '../../helpers/files-repos'; import { noGoogleQuota } from '../../helpers/google-quota'; -import { journalLinksStub } from '../../helpers/journal-links'; import { createTestJourneysRepo, createTestJourneyContributorsRepo, @@ -66,6 +65,7 @@ import { createTestJourneyPhotosRepo, createTestJourneyEntryPhotosRepo, } from '../../helpers/journey-repos'; +import { journalLinksStub } from '../../helpers/journey-share-repos'; import { createTestJourneyShareTokensRepo } from '../../helpers/journey-share-repos'; import { buildMapsService } from '../../helpers/maps-service'; import { notificationsStub } from '../../helpers/notifications'; diff --git a/server/tests/unit/nest/trips.service.test.ts b/server/tests/unit/nest/trips.service.test.ts index 4be01d1c1..245eb03ea 100644 --- a/server/tests/unit/nest/trips.service.test.ts +++ b/server/tests/unit/nest/trips.service.test.ts @@ -71,7 +71,6 @@ import { QueryHelpersService } from '../../../src/nest/query-helpers/query-helpe import fs from 'fs'; import path from 'path'; import { notificationsStub } from '../../helpers/notifications'; -import { journalLinksStub } from '../../helpers/journal-links'; import { EphemeralTokenService } from '../../../src/nest/auth-core/ephemeral-token.service'; import { createTestUnitOfWork, createTestAppSettingsRepo, createTestUsersRepo, sharedTestOrm, @@ -109,7 +108,7 @@ import { createTestJourneysRepo, createTestJourneyContributorsRepo, createTestJourneyTripsRepo, createTestJourneyEntriesRepo, createTestJourneyPhotosRepo, createTestJourneyEntryPhotosRepo, } from '../../helpers/journey-repos'; -import { createTestJourneyShareTokensRepo } from '../../helpers/journey-share-repos'; +import { createTestJourneyShareTokensRepo, journalLinksStub } from '../../helpers/journey-share-repos'; import { createTestShareTokensRepo, createTestPluginsRepo, createTestPluginUserErasureQueueRepo } from '../../helpers/share-repos'; import { createTestCollectionPlacesRepo } from '../../helpers/test-uow'; import { SettingsService } from '../../../src/nest/settings/settings.service';