mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
test(trips): the journal link stub beside the other journey share helpers
budget.service.db and trips.service tests are held at their size baselines; the stub now comes from journey-share-repos, which both already import, so neither suite grows.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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<JourneyBooksRepository> {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user