-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tests): refactor generated tests, feat(game use cases): add tests
- Loading branch information
1 parent
f8f034e
commit 4fcc557
Showing
30 changed files
with
478 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Game } from '../entities'; | ||
|
||
abstract class IGameService { | ||
abstract findAll(): Promise<Game[]>; | ||
} | ||
|
||
export { IGameService }; |
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,2 +1,4 @@ | ||
export * from './profile.abstract.service'; | ||
export * from './user.abstract.service'; | ||
export * from './game.abstract.service'; | ||
export * from './reply.abstract.service'; |
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,2 @@ | ||
export * from './typeorm-game.module'; | ||
export * from './typeorm-game.service'; |
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,17 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { Game } from 'src/core'; | ||
import { TypeOrmGameService } from './typeorm-game.service'; | ||
import { IGameService } from 'src/core/abstracts/game.abstract.service'; | ||
|
||
@Module({ | ||
imports: [TypeOrmModule.forFeature([Game])], | ||
providers: [ | ||
{ | ||
provide: IGameService, | ||
useClass: TypeOrmGameService, | ||
}, | ||
], | ||
exports: [IGameService], | ||
}) | ||
export class TypeOrmGameModule {} |
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 { Injectable } from '@nestjs/common'; | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import { Game } from 'src/core'; | ||
import { IGameService } from 'src/core/abstracts/game.abstract.service'; | ||
import { Repository } from 'typeorm'; | ||
|
||
@Injectable() | ||
export class TypeOrmGameService implements IGameService { | ||
constructor( | ||
@InjectRepository(Game) private readonly gameRepo: Repository<Game>, | ||
) {} | ||
|
||
async findAll(): Promise<Game[]> { | ||
return this.gameRepo.find(); | ||
} | ||
} |
Empty file.
Empty file.
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 { Injectable } from '@nestjs/common'; | ||
import { | ||
CreateProfileDto, | ||
IProfileService, | ||
UpdateProfileDto, | ||
User, | ||
} from 'src/core'; | ||
|
||
@Injectable() | ||
export class TypeOrmProfileService implements IProfileService { | ||
async createProfile(dto: CreateProfileDto): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
async updateProfile(dto: UpdateProfileDto): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
async deleteProfile(id: number): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
async findByUser(userId: number): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
async findRecommended(user: User, skip: number): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
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
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,8 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmGameModule } from 'src/frameworks/game/typeorm'; | ||
|
||
@Module({ | ||
imports: [TypeOrmGameModule], | ||
exports: [TypeOrmGameModule], | ||
}) | ||
export class GameModule {} |
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,17 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { ConfigModule } from '@nestjs/config'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
|
||
@Module({ | ||
imports: [ | ||
ConfigModule.forRoot({ | ||
isGlobal: true, | ||
}), | ||
TypeOrmModule.forRoot({ | ||
type: 'better-sqlite3', | ||
database: ':memory:', | ||
entities: [__dirname + '/../../../**/*.entity{.ts,.js}'], | ||
}), | ||
], | ||
}) | ||
export class MockDatabaseModule {} |
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
Oops, something went wrong.