Skip to content

chore: migrate tests from karma to jest#8

Merged
jajugoguma merged 4 commits intomasterfrom
chore/karma-to-jest
Jun 18, 2021
Merged

chore: migrate tests from karma to jest#8
jajugoguma merged 4 commits intomasterfrom
chore/karma-to-jest

Conversation

@jajugoguma
Copy link
Copy Markdown
Contributor

Please check if the PR fulfills these requirements

  • It's submitted to right branch according to our branching model
  • It's right issue type on title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has description for the breaking change

Description

  • remove karma-jasmine test environment
  • set jest test environment
  • tests migrate from jasmine to jest

Thank you for your contribution to TOAST UI product. 🎉 😘 ✨

@jajugoguma jajugoguma requested review from adhrinae and lja1018 June 17, 2021 09:57
Copy link
Copy Markdown

@adhrinae adhrinae left a comment

Choose a reason for hiding this comment

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

리뷰완료합니다 👏

Comment thread test/input.spec.js Outdated
input.changeText(item);
expect(input.placeholderEl).toContainText('first');

expect(input.placeholderEl.textContent).toContain('first');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

jest-dom 을 사용한다면 toHaveTextContent 단언이 있습니다.
https://github.com/testing-library/jest-dom#tohavetextcontent

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

기존에 toContainText 단언을 사용하고 있어서 부분 문자열에 대한 검증을 하기 위해 toContain 단언을 사용했습니다.
확인 결과, 해당 테스트는 문자열 전체에 대해 검사를 하는 것이 맞다고 판단되어 toHaveTextContent 단언을 사용하는 것으로 변경했습니다.

Comment thread test/setup-globals.js Outdated

expect.extend({
toBeSelected(actual) {
const result = actual.selected === true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 단언이 사용되는 테스트 케이스가 item, selectBox 두 개인데
item쪽의 테스트 케이스는 단언 자체가 private 구현에 의존하고 있어서 좀 걱정되네요.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

해당 커스텀 단언을 삭제하고 위 단언이 검증하던 속성인 'selected'의 값을 toBe 단언을 이용해 검증하는 것으로 변경했습니다.

Copy link
Copy Markdown

@lja1018 lja1018 left a comment

Choose a reason for hiding this comment

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

리뷰완료합니다.

@jajugoguma jajugoguma merged commit 715445a into master Jun 18, 2021
@jajugoguma jajugoguma deleted the chore/karma-to-jest branch June 18, 2021 18:55
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