-
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.
Merge branch 'main' into THR-18-dev-feature-h5p-editor
- Loading branch information
Showing
141 changed files
with
4,165 additions
and
1,942 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
69 changes: 48 additions & 21 deletions
69
apps/server/src/console/api-test/database-management.console.api.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 |
---|---|---|
@@ -1,52 +1,79 @@ | ||
import { INestApplicationContext } from '@nestjs/common'; | ||
import { BootstrapConsole, ConsoleService } from 'nestjs-console'; | ||
import { ConsoleWriterService } from '@shared/infra/console'; | ||
import { ServerConsoleModule } from '@src/console/console.module'; | ||
import { CommanderError } from 'commander'; | ||
import { execute, TestBootstrapConsole } from './test-bootstrap.console'; | ||
import { BootstrapConsole, ConsoleService } from 'nestjs-console'; | ||
import { TestBootstrapConsole, execute } from './test-bootstrap.console'; | ||
|
||
describe('DatabaseManagementConsole (API)', () => { | ||
let app: INestApplicationContext; | ||
let console: BootstrapConsole; | ||
let bootstrap: BootstrapConsole; | ||
let consoleService: ConsoleService; | ||
beforeAll(async () => { | ||
console = new TestBootstrapConsole({ | ||
let consoleWriter: ConsoleWriterService; | ||
|
||
beforeEach(async () => { | ||
bootstrap = new TestBootstrapConsole({ | ||
module: ServerConsoleModule, | ||
useDecorators: true, | ||
}); | ||
app = await console.init(); | ||
app = await bootstrap.init(); | ||
await app.init(); | ||
consoleService = app.get(ConsoleService); | ||
consoleWriter = app.get(ConsoleWriterService); | ||
}); | ||
|
||
afterAll(async () => { | ||
afterEach(async () => { | ||
consoleService.resetCli(); | ||
await app.close(); | ||
}); | ||
|
||
describe('Command "database"', () => { | ||
beforeEach(() => { | ||
const setup = () => { | ||
const cli = consoleService.getCli('database'); | ||
const exitFn = (err: CommanderError) => { | ||
if (err.exitCode !== 0) throw err; | ||
}; | ||
cli?.exitOverride(exitFn); | ||
const rootCli = consoleService.getRootCli(); | ||
rootCli.exitOverride(exitFn); | ||
}); | ||
const spyConsoleWriterInfo = jest.spyOn(consoleWriter, 'info'); | ||
return { spyConsoleWriterInfo }; | ||
}; | ||
describe('when command not exists', () => { | ||
it('should fail for unknown command', async () => { | ||
setup(); | ||
await expect(execute(bootstrap, ['database', 'not_existing_command'])).rejects.toThrow( | ||
`error: unknown command 'not_existing_command'` | ||
); | ||
|
||
afterEach(() => { | ||
consoleService.resetCli(); | ||
consoleService.resetCli(); | ||
}); | ||
}); | ||
|
||
it('should fail for unknown command', async () => { | ||
await expect(execute(console, ['database', 'not_existing_command'])).rejects.toThrow( | ||
`error: unknown command 'not_existing_command'` | ||
); | ||
}); | ||
it('should provide command "seed"', async () => { | ||
await execute(console, ['database', 'seed']); | ||
}); | ||
it('should provide command "export"', async () => { | ||
await execute(console, ['database', 'export']); | ||
describe('when command exists', () => { | ||
it('should provide command "seed"', async () => { | ||
const { spyConsoleWriterInfo } = setup(); | ||
|
||
await execute(bootstrap, ['database', 'seed']); | ||
|
||
expect(spyConsoleWriterInfo).toBeCalled(); | ||
}); | ||
|
||
it('should provide command "export"', async () => { | ||
const { spyConsoleWriterInfo } = setup(); | ||
|
||
await execute(bootstrap, ['database', 'export']); | ||
|
||
expect(spyConsoleWriterInfo).toBeCalled(); | ||
}); | ||
|
||
it('should provide command "sync-indexes"', async () => { | ||
const { spyConsoleWriterInfo } = setup(); | ||
|
||
await execute(bootstrap, ['database', 'sync-indexes']); | ||
|
||
expect(spyConsoleWriterInfo).toBeCalled(); | ||
}); | ||
}); | ||
}); | ||
}); |
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
2 changes: 1 addition & 1 deletion
2
apps/server/src/modules/authentication/strategy/jwt-validation.adapter.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
3 changes: 2 additions & 1 deletion
3
apps/server/src/modules/authentication/strategy/jwt-validation.adapter.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
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
18 changes: 18 additions & 0 deletions
18
apps/server/src/modules/board/controller/dto/user-data.response.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,18 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class UserDataResponse { | ||
constructor({ userId, firstName, lastName }: UserDataResponse) { | ||
this.userId = userId; | ||
this.firstName = firstName; | ||
this.lastName = lastName; | ||
} | ||
|
||
@ApiProperty() | ||
firstName!: string; | ||
|
||
@ApiProperty() | ||
lastName!: string; | ||
|
||
@ApiProperty() | ||
userId!: string; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { ClassService } from './service'; | ||
import { ClassesRepo } from './repo'; | ||
|
||
@Module({ | ||
providers: [ClassService, ClassesRepo], | ||
exports: [ClassService], | ||
}) | ||
export class ClassModule {} |
15 changes: 15 additions & 0 deletions
15
apps/server/src/modules/class/domain/class-source-options.do.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,15 @@ | ||
export interface ClassSourceOptionsProps { | ||
tspUid?: string; | ||
} | ||
|
||
export class ClassSourceOptions { | ||
protected props: ClassSourceOptionsProps; | ||
|
||
constructor(props: ClassSourceOptionsProps) { | ||
this.props = props; | ||
} | ||
|
||
get tspUid(): string | undefined { | ||
return this.props.tspUid; | ||
} | ||
} |
Oops, something went wrong.