Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EW-1083: TSP Refactoring #5449

Draft
wants to merge 91 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
80a3d13
EW-1057: made barrel exports changes and changed the imports
HKayed Nov 29, 2024
6172544
EW-1057: fixing an export
HKayed Nov 29, 2024
47a9878
BC-8213 - validate room dates (#5347)
MartinSchuhmacher Nov 29, 2024
6701a1d
EW-1057: fixed more imports
HKayed Nov 29, 2024
a77e5fe
EW-1057: some imports modified
HKayed Nov 29, 2024
d798d44
EW-1057: modified an import causing tests to break
HKayed Nov 29, 2024
f840ab4
Add and use Test Factories
MajedAlaitwniCap Nov 29, 2024
2676f20
Merge branch 'main' into EW-1053
MajedAlaitwniCap Dec 2, 2024
6184e18
Merge branch 'main' into EW-1053
MajedAlaitwniCap Dec 2, 2024
4e0f4e2
revert ExternalSchoolDto changes
MajedAlaitwniCap Dec 2, 2024
ba8417f
EW-1057: reverted the changes excluding @src
HKayed Dec 2, 2024
64b5ffb
N21-2264 Remove unused tools from courses (#5361)
MarvinOehlerkingCap Dec 2, 2024
b4e81d2
N21-2309 Fix validation and add support for unknown schulconnex group…
MarvinOehlerkingCap Dec 2, 2024
2cc1559
cleanup ancient and false information (#5357)
Loki-Afro Dec 2, 2024
17471ba
N21-2248 Create LTI 1.1 deep links with external tools (#5349)
MarvinOehlerkingCap Dec 2, 2024
8ed89d1
BC-7994 Remove unused dependency nodemon (#5366)
dyedwiper Dec 2, 2024
edd464e
Merge branch 'main' into EW-1057
HKayed Dec 2, 2024
22b41cb
Merge branch 'main' into EW-1053
MajedAlaitwniCap Dec 3, 2024
f8ac731
EW-1057: reverted non-needed changes to the index.ts files in folders…
HKayed Dec 3, 2024
3e6a35c
EW-1057: using src in core/logger
HKayed Dec 3, 2024
14ac944
EW-1057: fixing deep imports
HKayed Dec 3, 2024
959791b
EW-1057: fixed src/core/logger imports
HKayed Dec 3, 2024
6e3a643
add and use factories for robj export models
MajedAlaitwniCap Dec 4, 2024
02cb706
Merge branch 'main' into EW-1053
MajedAlaitwniCap Dec 4, 2024
e4aa8a3
add robj-export-schueler-migration factory
MajedAlaitwniCap Dec 4, 2024
2fcee4c
add new factories to index
MajedAlaitwniCap Dec 4, 2024
66a753e
EW-1057: reverted all non needed import changes
HKayed Dec 4, 2024
73d7c09
EW-1057: imports reverted
HKayed Dec 4, 2024
6ac88cc
EW-1055: moved tsp to strategy
HKayed Nov 28, 2024
bb958fb
EW-1055: All imports modified to suit the folder structural change an…
HKayed Nov 28, 2024
c2406d3
EW-1055: another import modification
HKayed Nov 28, 2024
1adc16a
EW-1055: renamed tsp.config to be sync.config
HKayed Nov 29, 2024
f7bbac1
EW-1055: modifed config name and import
HKayed Nov 29, 2024
6c80f6a
EW-1057: fixed imports
HKayed Dec 4, 2024
afed156
Merge branch 'main' into EW-1057
SimoneRadtke-Cap Dec 5, 2024
45a4b6a
Merge branch 'main' into EW-1053
MajedAlaitwniCap Dec 5, 2024
c71904b
revert adding new factories to index file
MajedAlaitwniCap Dec 5, 2024
87874ac
Merge branch 'main' into EW-1053
MajedAlaitwniCap Dec 6, 2024
662310c
Merge branch 'main' into EW-1053
MajedAlaitwniCap Dec 9, 2024
ee42f8e
Merge branch 'main' into EW-1053
MajedAlaitwniCap Dec 10, 2024
feda809
Merge branch 'main' of https://github.com/hpi-schul-cloud/schulcloud-…
MajedAlaitwniCap Dec 18, 2024
2d49b6b
modify externalUserDtoFactory
MajedAlaitwniCap Dec 18, 2024
4e6c0f6
reorder test factories to main modules
MajedAlaitwniCap Dec 19, 2024
ab87bfc
Merge branch 'main' into EW-1053
mkreuzkam-cap Jan 7, 2025
ffc1e28
Merge branch 'main' into EW-1057
mkreuzkam-cap Jan 7, 2025
102ff37
fix nest lint.
mkreuzkam-cap Jan 7, 2025
45d1206
orgabize imports
MajedAlaitwniCap Jan 13, 2025
16c01f9
Merge branch 'main' into EW-1053
MajedAlaitwniCap Jan 13, 2025
69b41d5
EW-1056: Remove for await and improve legibility.
mkreuzkam-cap Jan 13, 2025
21fefc9
Merge branch 'main' into EW-1056
mkreuzkam-cap Jan 13, 2025
27cc3de
Merge branch 'main' into EW-1056
mkreuzkam-cap Jan 15, 2025
410750b
Fix typos.
mkreuzkam-cap Jan 15, 2025
0f06801
Merge branch 'main' into EW-1053
MajedAlaitwniCap Jan 15, 2025
6e6e1e5
Merge branch 'EW-1057' into EW-1083
mkreuzkam-cap Jan 20, 2025
f5efcaa
Merge branch 'EW-1053' into EW-1083
mkreuzkam-cap Jan 20, 2025
1e3e9dd
Merge branch 'EW-1056' into EW-1083
mkreuzkam-cap Jan 20, 2025
e1374a4
Fix test error.
mkreuzkam-cap Jan 20, 2025
3e96b72
Fix test after merge.
mkreuzkam-cap Jan 20, 2025
6face40
Remaining comments from EW-1057.
mkreuzkam-cap Jan 20, 2025
7fad9ac
Merge branch 'main' into EW-1083
mkreuzkam-cap Jan 20, 2025
59e7a8a
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 21, 2025
14764a7
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 21, 2025
768d1bf
Use infer for types of config values.
mkreuzkam-cap Jan 21, 2025
22fc71c
Make order of calls clear and use Promise.all
mkreuzkam-cap Jan 21, 2025
a18f5a3
Merge branch 'main' into EW-1083
mkreuzkam-cap Jan 21, 2025
f24381e
EW-1083 Refactoring tests
SimoneRadtke-Cap Jan 21, 2025
e8ed1c2
Merge branch 'main' into EW-1083
mkreuzkam-cap Jan 21, 2025
3c71e56
Change error handling and rename fetch function.
mkreuzkam-cap Jan 21, 2025
6e392fe
Merge branch 'main' into EW-1083
mkreuzkam-cap Jan 22, 2025
746d676
Make client throw access token exception.
mkreuzkam-cap Jan 22, 2025
80592a0
Merge branch 'main' into EW-1083
mkreuzkam-cap Jan 23, 2025
7cf9c1b
Fix after refactoring.
mkreuzkam-cap Jan 23, 2025
cb2f41f
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 23, 2025
3293380
Merge branch 'main' into EW-1083
mkreuzkam-cap Jan 23, 2025
44d03ea
EW-1083 Refactoring test for tsp sync strategy
SimoneRadtke-Cap Jan 23, 2025
7caf619
Use typeguard in oauth data mapper.
mkreuzkam-cap Jan 24, 2025
74178c4
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 24, 2025
f2296c9
Split TspSyncService and rename to TspSchoolService.
mkreuzkam-cap Jan 24, 2025
34ffd29
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 24, 2025
5e821d0
EW-1083 Add typeguard to tsp provisioning service
SimoneRadtke-Cap Jan 24, 2025
07d72c7
Merge branch 'main' into EW-1083
mkreuzkam-cap Jan 28, 2025
407e225
EW-1083 Adjust readme
SimoneRadtke-Cap Jan 29, 2025
042911e
Fix off by one error in batch logging.
mkreuzkam-cap Jan 29, 2025
8e04b67
use typeguard and collapse object literals.
mkreuzkam-cap Jan 29, 2025
58eada0
Sync strategy refactoring.
mkreuzkam-cap Jan 29, 2025
c39bbf5
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 29, 2025
d26f9f6
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 30, 2025
2a51053
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 31, 2025
69958ae
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 31, 2025
6738ea4
Merge branch 'main' into EW-1083
mkreuzkam-cap Jan 31, 2025
b81a1a0
Merge branch 'main' into EW-1083
SimoneRadtke-Cap Jan 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions apps/server/src/infra/sync/console/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# Sync console

This is a console application that allows you to start the synchronization process for different sources.

## Usage

To start the synchronization process, run the following command:

```bash
npm run nest:start:console sync run <target>
```

Where `<target>` is the name of the system you want to start the synchronization for. The currently available systems are:

- `tsp` - Synchronize Thüringer schulportal.
- `vidis` - Synchronize Vidis Activation Data.
- `media_metadata` - Synchronize media metadata in ctl tools in SVS with data from its media source.


If the target is not provided, the synchronization will not start and the available targets will be displayed in an error message.

```bash
{
message: 'Either synchronization is not activated or the target entered is invalid',
Expand All @@ -22,4 +26,5 @@ If the target is not provided, the synchronization will not start and the availa
```

## TSP synchronization
The TSP synchronization is controlled with a feature flag `FEATURE_TSP_SYNC_ENABLED`. This is now set to `false`.

The TSP synchronization is controlled with a feature flag `FEATURE_TSP_SYNC_ENABLED`. This is now set to `false`.
2 changes: 1 addition & 1 deletion apps/server/src/infra/sync/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './tsp';
export * from './media-licenses';
export { TspSyncConfig, TspSyncStrategy } from './strategy/tsp';
export * from './media-metadata';
12 changes: 6 additions & 6 deletions apps/server/src/infra/sync/service/sync.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Test, TestingModule } from '@nestjs/testing';
import { createMock } from '@golevelup/ts-jest';
import { faker } from '@faker-js/faker';
import { Logger } from '@core/logger';
import { faker } from '@faker-js/faker';
import { createMock } from '@golevelup/ts-jest';
import { Test, TestingModule } from '@nestjs/testing';
import { InvalidTargetLoggable } from '../errors/invalid-target.loggable';
import { VidisSyncStrategy } from '../media-licenses';
import { MediaMetadataSyncStrategy } from '../media-metadata';
import { SyncStrategy } from '../strategy/sync-strategy';
import { TspSyncStrategy } from '../strategy/tsp/tsp-sync.strategy';
import { SyncStrategyTarget } from '../sync-strategy.types';
import { TspSyncStrategy } from '../tsp';
import { MediaMetadataSyncStrategy } from '../media-metadata';
import { VidisSyncStrategy } from '../media-licenses';
import { SyncService } from './sync.service';

describe(SyncService.name, () => {
Expand Down
8 changes: 4 additions & 4 deletions apps/server/src/infra/sync/service/sync.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Injectable, Optional } from '@nestjs/common';
import { Logger } from '@core/logger';
import { TspSyncStrategy } from '../tsp/tsp-sync.strategy';
import { SyncStrategy } from '../strategy/sync-strategy';
import { SyncStrategyTarget } from '../sync-strategy.types';
import { Injectable, Optional } from '@nestjs/common';
import { InvalidTargetLoggable } from '../errors/invalid-target.loggable';
import { VidisSyncStrategy } from '../media-licenses/strategy';
import { SyncStrategy } from '../strategy/sync-strategy';
import { TspSyncStrategy } from '../strategy/tsp/tsp-sync.strategy';
import { SyncStrategyTarget } from '../sync-strategy.types';
import { MediaMetadataSyncStrategy } from '../media-metadata/strategy';

@Injectable()
Expand Down
12 changes: 12 additions & 0 deletions apps/server/src/infra/sync/strategy/tsp/loggable/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export { TspDataFetchedLoggable } from './tsp-data-fetched.loggable';
export { TspLegacyMigrationStartLoggable } from './tsp-legacy-migration-start.loggable';
export { TspLegacySchoolMigrationCountLoggable } from './tsp-legacy-school-migration-count.loggable';
export { TspLegacySchoolMigrationSuccessLoggable } from './tsp-legacy-school-migration-success.loggable';
export { TspMissingExternalIdLoggable } from './tsp-missing-external-id.loggable';
export { TspSchoolsFetchedLoggable } from './tsp-schools-fetched.loggable';
export { TspSchoolsSyncedLoggable } from './tsp-schools-synced.loggable';
export { TspSchulnummerMissingLoggable } from './tsp-schulnummer-missing.loggable';
export { TspSyncedUsersLoggable } from './tsp-synced-users.loggable';
export { TspSyncingUsersLoggable } from './tsp-syncing-users.loggable';
export { TspSystemNotFoundLoggableException } from './tsp-system-not-found.loggable-exception';
export { TspUsersMigratedLoggable } from './tsp-users-migrated.loggable';
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TspAccessTokenLoggableError } from './tsp-access-token.loggable-error';

describe(TspAccessTokenLoggableError.name, () => {
describe('getLogMessage is called', () => {
const setup = () => {
const expected = {
type: 'TSP_ACCESS_TOKEN_ERROR',
message: 'The TSP access token could not be generated during the sync',
stack: expect.any(String),
};

return { expected };
};

it('should return a log message', () => {
const { expected } = setup();

const loggable = new TspAccessTokenLoggableError();

expect(loggable.getLogMessage()).toEqual(expected);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Loggable, LogMessage } from '@core/logger';
import { HttpStatus } from '@nestjs/common';
import { BusinessError, ErrorLogMessage } from '@shared/common/error';

export class TspAccessTokenLoggableError extends BusinessError implements Loggable {
constructor() {
super(
{
type: 'TSP_ACCESS_TOKEN_ERROR',
title: 'The TSP access token could not be generated',
defaultMessage: 'The TSP access token could not be generated during the sync',
},
HttpStatus.BAD_REQUEST
);
}

public getLogMessage(): LogMessage | ErrorLogMessage {
const message: LogMessage | ErrorLogMessage = {
message: this.message,
type: this.type,
stack: this.stack,
};

return message;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DomainErrorHandler } from '@core/error';
import { AxiosErrorLoggable, ErrorLoggable } from '@core/error/loggable';
import { Logger } from '@core/logger';
import { faker } from '@faker-js/faker';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import {
Expand All @@ -12,6 +12,14 @@ import {
RobjExportSchule,
TspClientFactory,
} from '@infra/tsp-client';
import {
robjExportKlasseFactory,
robjExportLehrerFactory,
robjExportLehrerMigrationFactory,
robjExportSchuelerFactory,
robjExportSchuelerMigrationFactory,
robjExportSchuleFactory,
} from '@infra/tsp-client/testing';
import { OauthConfigMissingLoggableException } from '@modules/oauth/loggable';
import { systemFactory } from '@modules/system/testing';
import { Test, TestingModule } from '@nestjs/testing';
Expand All @@ -22,7 +30,7 @@ describe(TspFetchService.name, () => {
let module: TestingModule;
let sut: TspFetchService;
let tspClientFactory: DeepMocked<TspClientFactory>;
let logger: DeepMocked<Logger>;
let domainErrorHandler: DeepMocked<DomainErrorHandler>;

beforeAll(async () => {
module = await Test.createTestingModule({
Expand All @@ -33,19 +41,18 @@ describe(TspFetchService.name, () => {
useValue: createMock<TspClientFactory>(),
},
{
provide: Logger,
useValue: createMock<Logger>(),
provide: DomainErrorHandler,
useValue: createMock<DomainErrorHandler>(),
},
],
}).compile();

sut = module.get(TspFetchService);
tspClientFactory = module.get(TspClientFactory);
logger = module.get(Logger);
domainErrorHandler = module.get(DomainErrorHandler);
});

afterEach(() => {
jest.clearAllMocks();
jest.resetAllMocks();
});

Expand All @@ -60,8 +67,8 @@ describe(TspFetchService.name, () => {
});

const setupTspClient = () => {
const clientId = faker.string.alpha();
const clientSecret = faker.string.alpha();
const clientId = faker.string.uuid();
const clientSecret = faker.string.alphanumeric(40);
const tokenEndpoint = faker.internet.url();
const system = systemFactory.build({
oauthConfig: {
Expand All @@ -71,61 +78,37 @@ describe(TspFetchService.name, () => {
},
});

const tspSchool: RobjExportSchule = {
schuleName: faker.string.alpha(),
schuleNummer: faker.string.alpha(),
};
const tspSchool = robjExportSchuleFactory.build();
const schools = [tspSchool];
const responseSchools = createMock<AxiosResponse<Array<RobjExportSchule>>>({
data: schools,
});

const tspTeacher: RobjExportLehrer = {
schuleNummer: faker.string.alpha(),
lehrerVorname: faker.string.alpha(),
lehrerNachname: faker.string.alpha(),
lehrerUid: faker.string.alpha(),
};
const tspTeacher = robjExportLehrerFactory.build();
const teachers = [tspTeacher];
const responseTeachers = createMock<AxiosResponse<Array<RobjExportLehrer>>>({
data: teachers,
});

const tspStudent: RobjExportSchueler = {
schuleNummer: faker.string.alpha(),
schuelerVorname: faker.string.alpha(),
schuelerNachname: faker.string.alpha(),
schuelerUid: faker.string.alpha(),
};
const tspStudent = robjExportSchuelerFactory.build();
const students = [tspStudent];
const responseStudents = createMock<AxiosResponse<Array<RobjExportSchueler>>>({
data: students,
});

const tspClass: RobjExportKlasse = {
schuleNummer: faker.string.alpha(),
klasseId: faker.string.alpha(),
klasseName: faker.string.alpha(),
lehrerUid: faker.string.alpha(),
};
const tspClass = robjExportKlasseFactory.build();
const classes = [tspClass];
const responseClasses = createMock<AxiosResponse<Array<RobjExportKlasse>>>({
data: classes,
});

const tspTeacherMigration: RobjExportLehrerMigration = {
lehrerUidAlt: faker.string.alpha(),
lehrerUidNeu: faker.string.alpha(),
};
const tspTeacherMigration = robjExportLehrerMigrationFactory.build();
const teacherMigrations = [tspTeacherMigration];
const responseTeacherMigrations = createMock<AxiosResponse<Array<RobjExportLehrerMigration>>>({
data: teacherMigrations,
});

const tspStudentMigration: RobjExportSchuelerMigration = {
schuelerUidAlt: faker.string.alpha(),
schuelerUidNeu: faker.string.alpha(),
};
const tspStudentMigration = robjExportSchuelerMigrationFactory.build();
const studentMigrations = [tspStudentMigration];
const responseStudentMigrations = createMock<AxiosResponse<Array<RobjExportSchuelerMigration>>>({
data: studentMigrations,
Expand Down Expand Up @@ -359,8 +342,8 @@ describe(TspFetchService.name, () => {
const setup = () => {
const system = systemFactory.build({
oauthConfig: {
clientId: faker.string.alpha(),
clientSecret: faker.string.alpha(),
clientId: faker.string.uuid(),
clientSecret: faker.string.alphanumeric(40),
tokenEndpoint: faker.internet.url(),
},
});
Expand All @@ -383,16 +366,18 @@ describe(TspFetchService.name, () => {

await sut.fetchTspSchools(system, 1);

expect(logger.warning).toHaveBeenCalledWith(new AxiosErrorLoggable(new AxiosError(), 'TSP_FETCH_ERROR'));
expect(domainErrorHandler.exec).toHaveBeenCalledWith(
new AxiosErrorLoggable(new AxiosError(), 'TSP_FETCH_ERROR')
);
});
});

describe('when generic Error is thrown', () => {
const setup = () => {
const system = systemFactory.build({
oauthConfig: {
clientId: faker.string.alpha(),
clientSecret: faker.string.alpha(),
clientId: faker.string.uuid(),
clientSecret: faker.string.alphanumeric(40),
tokenEndpoint: faker.internet.url(),
},
});
Expand All @@ -415,7 +400,7 @@ describe(TspFetchService.name, () => {

await sut.fetchTspSchools(system, 1);

expect(logger.warning).toHaveBeenCalledWith(new ErrorLoggable(new Error()));
expect(domainErrorHandler.exec).toHaveBeenCalledWith(new ErrorLoggable(new Error()));
});
});
});
Expand All @@ -428,10 +413,15 @@ describe(TspFetchService.name, () => {
return { system };
};

it('should throw an OauthConfigMissingLoggableException', async () => {
it('should throw an OauthConfigMissingLoggableException into domainErrorHandler', async () => {
const { system } = setup();

await expect(async () => sut.fetchTspSchools(system, 1)).rejects.toThrow(OauthConfigMissingLoggableException);
const result = await sut.fetchTspSchools(system, 1);
expect(result).toStrictEqual([]);

expect(domainErrorHandler.exec).toHaveBeenCalledWith(
new ErrorLoggable(new OauthConfigMissingLoggableException(system.id))
);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DomainErrorHandler } from '@core/error';
import { AxiosErrorLoggable, ErrorLoggable } from '@core/error/loggable';
import { Logger } from '@core/logger';
import {
ExportApiInterface,
RobjExportKlasse,
Expand All @@ -18,9 +18,10 @@ import moment from 'moment';

@Injectable()
export class TspFetchService {
constructor(private readonly tspClientFactory: TspClientFactory, private readonly logger: Logger) {
this.logger.setContext(TspFetchService.name);
}
constructor(
private readonly tspClientFactory: TspClientFactory,
private readonly domainErrorHandler: DomainErrorHandler
) {}

public fetchTspSchools(system: System, daysToFetch: number): Promise<RobjExportSchule[]> {
const lastChangeDate = this.formatChangeDate(daysToFetch);
Expand Down Expand Up @@ -64,20 +65,21 @@ export class TspFetchService {

private async fetchTsp<T>(
system: System,
fetch: (client: ExportApiInterface) => Promise<AxiosResponse<T>>,
fetchFunction: (client: ExportApiInterface) => Promise<AxiosResponse<T>>,
defaultValue: T
): Promise<T> {
const client = this.createClient(system);
try {
const response = await fetch(client);
const client = this.createClient(system);

const response = await fetchFunction(client);
const { data } = response;

return data;
} catch (e) {
if (e instanceof AxiosError) {
this.logger.warning(new AxiosErrorLoggable(e, 'TSP_FETCH_ERROR'));
this.domainErrorHandler.exec(new AxiosErrorLoggable(e, 'TSP_FETCH_ERROR'));
} else {
this.logger.warning(new ErrorLoggable(e));
this.domainErrorHandler.exec(new ErrorLoggable(e));
}
}
return defaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ describe('account repo', () => {
await cleanupCollections(em);
});

describe('migrateLegacyData', () => {
describe('prepareLegacySyncDataForNewSync', () => {
describe('when legacy system is not found', () => {
it('should log TspLegacyMigrationSystemMissingLoggable', async () => {
await sut.migrateLegacyData('');
await sut.prepareLegacySyncDataForNewSync('');

expect(logger.info).toHaveBeenCalledWith(new TspLegacyMigrationSystemMissingLoggable());
});
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('account repo', () => {
it('should update the school to the new format', async () => {
const { newSystem, legacySchool, schoolId: schoolIdentifier } = await setup();

await sut.migrateLegacyData(newSystem.id);
await sut.prepareLegacySyncDataForNewSync(newSystem.id);

const migratedSchool = await em.findOne<SchoolEntity>(SchoolEntity.name, {
id: legacySchool.id,
Expand Down
Loading
Loading