-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
12 changed files
with
369 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
apps/server/src/modules/user-import/loggable/user-already-migrated.loggable.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { UserAlreadyMigratedLoggable } from './user-already-migrated.loggable'; | ||
|
||
describe('UserAlreadyMigratedLoggable', () => { | ||
describe('getLogMessage', () => { | ||
const setup = () => { | ||
const userId = 'userId'; | ||
const loggable = new UserAlreadyMigratedLoggable(userId); | ||
|
||
return { | ||
loggable, | ||
userId, | ||
}; | ||
}; | ||
|
||
it('should return the correct log message', () => { | ||
const { loggable, userId } = setup(); | ||
|
||
expect(loggable.getLogMessage()).toEqual({ | ||
message: 'The user has migrated already and will be skipped during migration process.', | ||
data: { | ||
userId, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
apps/server/src/modules/user-import/loggable/user-already-migrated.loggable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; | ||
|
||
export class UserAlreadyMigratedLoggable implements Loggable { | ||
constructor(private readonly userId: string) {} | ||
|
||
getLogMessage(): LogMessage | ErrorLogMessage | ValidationErrorLogMessage { | ||
return { | ||
message: 'The user has migrated already and will be skipped during migration process.', | ||
data: { | ||
userId: this.userId, | ||
}, | ||
}; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/server/src/modules/user-import/loggable/user-migration-canceled.loggable.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { legacySchoolDoFactory } from '@shared/testing'; | ||
import { UserMigrationCanceledLoggable } from './user-migration-canceled.loggable'; | ||
|
||
describe('UserMigrationCanceledLoggable', () => { | ||
describe('getLogMessage', () => { | ||
const setup = () => { | ||
const school = legacySchoolDoFactory.buildWithId({ name: 'Schoolname' }); | ||
const loggable = new UserMigrationCanceledLoggable(school); | ||
|
||
return { | ||
loggable, | ||
school, | ||
}; | ||
}; | ||
|
||
it('should return the correct log message', () => { | ||
const { loggable, school } = setup(); | ||
|
||
const message = loggable.getLogMessage(); | ||
|
||
expect(message).toEqual({ | ||
message: 'The user migration was canceled.', | ||
data: { | ||
schoolName: school.name, | ||
schoolId: school.id, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
apps/server/src/modules/user-import/loggable/user-migration-canceled.loggable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { LegacySchoolDo } from '@shared/domain/domainobject'; | ||
import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; | ||
|
||
export class UserMigrationCanceledLoggable implements Loggable { | ||
constructor(private readonly school: LegacySchoolDo) {} | ||
|
||
getLogMessage(): LogMessage | ErrorLogMessage | ValidationErrorLogMessage { | ||
return { | ||
message: 'The user migration was canceled.', | ||
data: { | ||
schoolName: this.school.name, | ||
schoolId: this.school.id, | ||
}, | ||
}; | ||
} | ||
} |
Oops, something went wrong.