Skip to content

Commit

Permalink
Merge pull request #39 from GuningShen/main
Browse files Browse the repository at this point in the history
Refactor: Add integration test and unit test (sample)
  • Loading branch information
GuningShen authored Aug 6, 2024
2 parents 4491778 + 6dbe3ad commit 72a4607
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# [1.1.0](https://github.com/GuningShen/treetracker-like/compare/v1.0.0...v1.1.0) (2024-08-06)


### Bug Fixes

* cmd [skip-ci] ([5fbfaea](https://github.com/GuningShen/treetracker-like/commit/5fbfaea800448a7bb819c2ba5fa6ce336ab0383f))
* rm branch [skip-ci] ([64cd0d9](https://github.com/GuningShen/treetracker-like/commit/64cd0d9ea55a216e8c98bf8725f8a5e2dd0e2a4f))
* run test on pr creation skip-ci ([e0495d4](https://github.com/GuningShen/treetracker-like/commit/e0495d40d0cbbb9836dc4da7e2ee88b1ac823606))
* use yarn instead of npm [ski-ci] ([6b22f17](https://github.com/GuningShen/treetracker-like/commit/6b22f17a9fbec14038b35a670542f473bebed6ec))


### Features

* add semantic versiining [skip-ci] ([2ff8a85](https://github.com/GuningShen/treetracker-like/commit/2ff8a85db2e243d5fac58db97fa42a7ebcfdec7c))
* migrate from nx to yarn ([0179a49](https://github.com/GuningShen/treetracker-like/commit/0179a49aa0460eb3f1d7074069a804f7518ef703))

## [1.3.1](https://github.com/Greenstand/treetracker-like/compare/v1.3.0...v1.3.1) (2024-07-31)


Expand Down
1 change: 1 addition & 0 deletions apps/like/__test__/object.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This file contains integration tests for the Object Module.
1 change: 1 addition & 0 deletions apps/like/__test__/type.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This file contains integration tests for the Type module.
1 change: 1 addition & 0 deletions apps/like/__test__/user.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This file contains integration tests for the User Module.
59 changes: 59 additions & 0 deletions apps/like/src/object/object.controller.spec.ts
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);
// });
// });
// });
1 change: 1 addition & 0 deletions apps/like/src/type/type.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This file contains unit tests for the TypeController class.
1 change: 1 addition & 0 deletions apps/like/src/user/user.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This file contains the unit tests for the UserController class.

0 comments on commit 72a4607

Please sign in to comment.