-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(factories): add or improve factories among tests (#145)
- Loading branch information
1 parent
5b3650f
commit 8cedb0e
Showing
36 changed files
with
26,916 additions
and
26,817 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
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
15 changes: 15 additions & 0 deletions
15
tests/factories/game/dto/create-game/create-game-options/create-game-options.dto.factory.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 @@ | ||
import { faker } from "@faker-js/faker"; | ||
import { plainToInstance } from "class-transformer"; | ||
import { CreateGameOptionsDto } from "../../../../../../src/modules/game/dto/create-game/create-game-options/create-game-options.dto"; | ||
import { plainToInstanceDefaultOptions } from "../../../../../../src/shared/validation/constants/validation.constant"; | ||
import { createFakeRolesGameOptionsDto } from "./create-roles-game-options/create-roles-game-options.dto.factory"; | ||
|
||
function createFakeGameOptionsDto(createGameOptionsDto: Partial<CreateGameOptionsDto> = {}, override: object = {}): CreateGameOptionsDto { | ||
return plainToInstance(CreateGameOptionsDto, { | ||
composition: { isHidden: createGameOptionsDto.composition?.isHidden ?? faker.datatype.boolean() }, | ||
roles: createFakeRolesGameOptionsDto(createGameOptionsDto.roles), | ||
...override, | ||
}, plainToInstanceDefaultOptions); | ||
} | ||
|
||
export { createFakeGameOptionsDto }; |
Oops, something went wrong.