Skip to content

Commit

Permalink
🐛 fix: 메소드 수정에 따른 테스트 수정 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
synoti21 committed Nov 29, 2023
1 parent e06f8e2 commit 7efb51d
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/domain/family_member/family-member.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class FamilyMemberService {
createFamilyMemberDto.role,
family,
user,
createFamilyMemberDto.fcmToken,
);
const savedMember = await this.familyMemberRepository.save(familyMember);
family.memberNumber += 1;
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/family-member.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('FamilyMemberController (e2e)', () => {
1,
mockFamily,
mockUser,
'test',
);
mockFamilyMember.setId(1);

Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/family.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('FamilyController (e2e)', () => {
1,
mockFamily,
mockUser,
'test',
);
beforeEach(async () => {
mockFamilyService = {
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/post.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('PostController (e2e)', () => {
'testTitle',
'testContext',
new Date(),
FamilyMember.createFamilyMember(1, null, null),
FamilyMember.createFamilyMember(1, null, null, ''),
);

beforeEach(async () => {
Expand Down
13 changes: 7 additions & 6 deletions src/test/service/family-member.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe('FamilyMemberService', () => {
createFamilyMemberDto.role,
family,
user,
createFamilyMemberDto.fcmToken,
);
user.id = 1;
familyMember.setId(1);
Expand All @@ -84,7 +85,7 @@ describe('FamilyMemberService', () => {
};
const family: Family = Family.createFamily('test', 'testKeyCode');
const user: User = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
user.id = 1;
familyMember.setId(1);

Expand All @@ -100,7 +101,7 @@ describe('FamilyMemberService', () => {
it('should delete family-member', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
familyMember.setId(1);

jest
Expand All @@ -117,7 +118,7 @@ describe('FamilyMemberService', () => {
it('should find family-member by user id', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
familyMember.setId(1);

jest.spyOn(userRepository, 'findOne').mockResolvedValue(user);
Expand All @@ -132,7 +133,7 @@ describe('FamilyMemberService', () => {
it('should find family by family-member id', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
familyMember.setId(1);
family.setId(1);

Expand All @@ -149,7 +150,7 @@ describe('FamilyMemberService', () => {
it('should find all family-member by family id', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
familyMember.setId(10);
family.setId(1);

Expand All @@ -165,7 +166,7 @@ describe('FamilyMemberService', () => {
it('should find family-member by family-member id', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
familyMember.setId(1);

jest
Expand Down
2 changes: 1 addition & 1 deletion src/test/service/family.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('FamilyService', () => {
familyKeyCode,
);
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
familyMember.setId(1);
family.setId(1);
user.setId(1);
Expand Down
8 changes: 4 additions & 4 deletions src/test/service/interaction.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('InteractionService', () => {
const user = User.createUser('test', 'test', 'test', 'test', 10, 1);
user.setId(1);
family.setId(2);
const dstFamilyMember = FamilyMember.createFamilyMember(1, family, user);
const dstFamilyMember = FamilyMember.createFamilyMember(1, family, user, '');
dstFamilyMember.fcmToken = 'test';
dstFamilyMember.setId(3);
const createInteractionDto: CreateInteractionDto = {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('InteractionService', () => {
it('should find all interactions', async () => {
//given
const familyMemberId = 1;
const dstFamilyMember = FamilyMember.createFamilyMember(1, null, null);
const dstFamilyMember = FamilyMember.createFamilyMember(1, null, null, '');
dstFamilyMember.setId(2);
const interaction = Interaction.createInteraction(1, dstFamilyMember, 2);
interaction.id = 3;
Expand All @@ -102,7 +102,7 @@ describe('InteractionService', () => {
it('should check all interactions', async () => {
//given
const familyMemberId = 1;
const dstFamilyMember = FamilyMember.createFamilyMember(1, null, null);
const dstFamilyMember = FamilyMember.createFamilyMember(1, null, null, '');
const interaction = Interaction.createInteraction(1, dstFamilyMember, 2);
const interactions = [interaction];

Expand All @@ -121,7 +121,7 @@ describe('InteractionService', () => {
//given
const interactionId = 1;
const interaction = Interaction.createInteraction(1, null, 2);
const familyMember = FamilyMember.createFamilyMember(1, null, null);
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');

jest.spyOn(interactionRepository, 'findOne').mockResolvedValue(interaction);
jest.spyOn(interactionRepository, 'delete').mockResolvedValue(null);
Expand Down
8 changes: 4 additions & 4 deletions src/test/service/post.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('PostService', () => {
});

it('should create post', async () => {
const familyMember = FamilyMember.createFamilyMember(1, null, null);
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');
const post = Post.createPost('test', 'test', new Date(), familyMember);
post.id = 1;

Expand All @@ -62,7 +62,7 @@ describe('PostService', () => {
});

it('should update post', async () => {
const familyMember = FamilyMember.createFamilyMember(1, null, null);
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');
const post = Post.createPost('test', 'test', new Date(), familyMember);
post.id = 1;

Expand All @@ -85,7 +85,7 @@ describe('PostService', () => {
});

it('should delete post', async () => {
const familyMember = FamilyMember.createFamilyMember(1, null, null);
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');
const post = Post.createPost('test', 'test', new Date(), familyMember);
post.id = 1;

Expand All @@ -98,7 +98,7 @@ describe('PostService', () => {
});

it('should get post list', async () => {
const familyMember = FamilyMember.createFamilyMember(1, null, null);
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');
familyMember.id = 1;
const post = Post.createPost('test', 'test', new Date(), familyMember);
post.id = 1;
Expand Down

0 comments on commit 7efb51d

Please sign in to comment.