-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from GuningShen/main
Refactor: Add integration test and unit test (sample)
- Loading branch information
Showing
7 changed files
with
80 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// This file contains integration tests for the Object Module. |
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 @@ | ||
// This file contains integration tests for the Type module. |
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 @@ | ||
// This file contains integration tests for the User Module. |
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,59 @@ | ||
// This file contains the unit tests of the ObjectController class. | ||
|
||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { ObjectController } from './object.controller'; | ||
import { ObjectService } from './object.service'; | ||
|
||
// describe('ObjectController', () => { | ||
// let controller: ObjectController; | ||
// let service: ObjectService; | ||
|
||
// beforeEach(async () => { | ||
// const module: TestingModule = await Test.createTestingModule({ | ||
// controllers: [ObjectController], | ||
// providers: [ObjectService], | ||
// }).compile(); | ||
|
||
// controller = module.get<ObjectController>(ObjectController); | ||
// service = module.get<ObjectService>(ObjectService); | ||
// }); | ||
|
||
// describe('handleGetObjectLikes', () => { | ||
// it('should call the service method to get object likes', async () => { | ||
// const type_id = '1'; | ||
// const object_id = '2'; | ||
|
||
// const serviceSpy = jest.spyOn(service, 'getObjectLikes'); | ||
|
||
// await controller.handleGetObjectLikes(type_id, object_id); | ||
|
||
// expect(serviceSpy).toHaveBeenCalledWith(type_id, object_id); | ||
// }); | ||
// }); | ||
|
||
// describe('handleLikeObject', () => { | ||
// it('should call the service method to like an object', async () => { | ||
// const type_id = '1'; | ||
// const object_id = '2'; | ||
|
||
// const serviceSpy = jest.spyOn(service, 'likeObject'); | ||
|
||
// await controller.handleLikeObject(type_id, object_id); | ||
|
||
// expect(serviceSpy).toHaveBeenCalledWith(type_id, object_id); | ||
// }); | ||
// }); | ||
|
||
// describe('handleUnlikeObject', () => { | ||
// it('should call the service method to unlike an object', async () => { | ||
// const type_id = '1'; | ||
// const object_id = '2'; | ||
|
||
// const serviceSpy = jest.spyOn(service, 'unlikeObject'); | ||
|
||
// await controller.handleUnlikeObject(type_id, object_id); | ||
|
||
// expect(serviceSpy).toHaveBeenCalledWith(type_id, object_id); | ||
// }); | ||
// }); | ||
// }); |
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 @@ | ||
// This file contains unit tests for the TypeController class. |
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 @@ | ||
// This file contains the unit tests for the UserController class. |