Skip to content

Commit

Permalink
Merge pull request #58 from Fam-Story/fix/57-omit-fcmtoken
Browse files Browse the repository at this point in the history
Fix: fcmToken 누락 수정 (#57)
  • Loading branch information
synoti21 authored Nov 29, 2023
2 parents 933699b + 7efb51d commit 25dcc24
Show file tree
Hide file tree
Showing 9 changed files with 22 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
2 changes: 2 additions & 0 deletions src/infra/entities/family-member.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ export class FamilyMember {
role: number,
family: Family,
user: User,
fcmToken: string,
): FamilyMember {
const familyMember = new FamilyMember();
familyMember.role = role;
familyMember.pokeCount = 0;
familyMember.talkCount = 0;
familyMember.family = family;
familyMember.user = user;
familyMember.fcmToken = fcmToken;
return familyMember;
}

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 25dcc24

Please sign in to comment.