Skip to content

Commit

Permalink
Merge pull request #387 from HyoJongPark/be/test/diary-e2e
Browse files Browse the repository at this point in the history
[BE] Diary E2E 테스트 작성
  • Loading branch information
HyoJongPark authored Feb 11, 2024
2 parents e4c9dac + 6860975 commit 249fb45
Show file tree
Hide file tree
Showing 6 changed files with 840 additions and 59 deletions.
1 change: 1 addition & 0 deletions backend/src/configs/typeorm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ export const typeORMTestConfig: TypeOrmModuleOptions = {
database: process.env.TEST_DB_NAME,
entities: [__dirname + '/../**/*.entity.{js,ts}'],
synchronize: true,
dropSchema: true,
};
3 changes: 3 additions & 0 deletions backend/src/diaries/diaries.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export class DiariesRepository extends Repository<Diary> {
.groupBy('diary.id')
.getRawOne();

if (!diaryInfo) {
return diaryInfo;
}
diaryInfo.tagNames = diaryInfo.tagNames ? diaryInfo.tagNames.split(',') : [];
diaryInfo.reactionCount = Number(diaryInfo.reactionCount);

Expand Down
8 changes: 7 additions & 1 deletion backend/src/tags/tags.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export class TagsService {
constructor(private readonly tagsRepository: TagsRepository) {}

async mapTagNameToTagType(tagNames: string[]) {
if (!tagNames) return null;
if (!tagNames) {
return null;
}

return Promise.all(
tagNames.map(async (tagName) => {
Expand All @@ -21,6 +23,10 @@ export class TagsService {
}

async updateDataSetScore(userId: number, tagNames: string[]) {
if (!tagNames) {
return;
}

const promises = tagNames.map(async (tag) => {
const tagScore = await this.tagsRepository.zscore(`${userId}`, tag);

Expand Down
Loading

0 comments on commit 249fb45

Please sign in to comment.