Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] SummaryUtil 리팩토링(#723) #756

Merged
merged 3 commits into from
Nov 20, 2024
Merged

Conversation

pithesun
Copy link
Contributor

@pithesun pithesun commented Oct 6, 2024

Related issue

#723

Result

  • 리팩토링 전, 테스트를 진행했습니다.
    getInitData 의 주요 역할이
  1. 한 클러스터 내의 author들을 중복없이 보여준다.
  2. 클러스터의 첫번째 커밋 메세지를 노출한다.
  3. 가장 최신의 릴리스 태그를 노출한다
    로 보았는데, 1번에 대한 테스트코드를 추가해보았습니다.
image

Work list

  1. map -> forEach로 변경
  2. authorSet을 여러 군데에서 변경 및 혼동되는 변수 네이밍 변경
  3. 최종 리턴값에 담길 cluster 변수를 마지막에 세팅 (여러번 객체의 값 변경 하는 방식 지양)

Discussion

@pithesun pithesun requested review from a team as code owners October 6, 2024 03:43
@pithesun pithesun self-assigned this Oct 6, 2024
ytaek
ytaek previously approved these changes Oct 6, 2024
Copy link
Contributor

@ytaek ytaek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

멋진 리팩토링입니다!! 👍
test case에 대한 comment 조금 남겼습니다.~

expect(result[0].summary.content.message).toBe("Initial commit");
});

test("클러스터의 커밋 작성자 이름이 중복되지 않는다.", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code는 가급적 한글보다는 영어로 작성해주시면 감사하겠습니다!

Comment on lines 98 to 102
const isUnique = result
.map((data) => data.summary.authorNames.length === new Set(data.summary.authorNames).size)
.every((value) => value === true);

expect(isUnique).toBe(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분이 정말 아리까리 하네요.

  • 일단 test에 logic이 들어가있어서, 이 isUnique에 대한 test가 또 필요할 것 같아요.
  • test에는 가급적 value로 정해주면 좋겠습니다.
  • 그리고, 하나의 action(result값)에 대한 assertion만 따로 해서 분리를 했는데, 이럴꺼면 getInitData test에 통합시키는게 맞을 것 같긴 합니다.

// set names
const authorSet: Set<string> = new Set();
commitNode.commit.author.names.map((name) => {
commitNode.commit.author.names.forEach((name) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍

xxxjinn
xxxjinn previously approved these changes Oct 15, 2024
Copy link
Contributor

@xxxjinn xxxjinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM입니다!!!🙂🙂🙂

@ytaek
Copy link
Contributor

ytaek commented Oct 16, 2024

@pithesun 님,
참고로 refactoring은 말머리를 refactor를 써서 표현하면 좋겠습니다! (commit convention). PR, commit 전부다요.
작업 완료되신거면 merge 부탁드립니다!

@pithesun
Copy link
Contributor Author

넵 수정해서 오늘중으로 머지하겠습니다!😄

@pithesun pithesun dismissed stale reviews from xxxjinn and ytaek via 9dc298c October 20, 2024 16:02
@pithesun pithesun changed the title SummaryUtil 리팩토링(#723) [Refacor] SummaryUtil 리팩토링(#723) Oct 20, 2024
@pithesun pithesun changed the title [Refacor] SummaryUtil 리팩토링(#723) [Refactor] SummaryUtil 리팩토링(#723) Oct 20, 2024
Copy link
Contributor

@ytaek ytaek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@pithesun pithesun requested review from xxxjinn and rakseong October 23, 2024 14:57
@ytaek ytaek merged commit 77434a7 into githru:main Nov 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants