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

[Test] Enable unit test suites in telemetry/public/components #532

Merged
merged 1 commit into from
Jun 25, 2021

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Jun 22, 2021

Description

All the unit tests related to unused telemetry are temporarily
skipped after the fork. Unit tests of the disabled telemetry
functions should also be modified correspondingly. To build
a clean unit test, we decide to modify and enable all the
working unit tests. This PR enables three test suites in dir
src/plugins/telemetry/public/components, which includes:

  1. opt_in_banner.test.tsx,
  2. opt_in_message.test.tsx,
  3. opted_in_notice_banner.test.tsx

Signed-off-by: Anan Zhuang [email protected]

Issues Resolved

#516
#517
#518

Test results

unit test for opt_in_banner.test.tsx

yarn test:jest /home/anan/work/OpenSearch-Dashboards/src/plugins/telemetry/public/components/opt_in_banner.test.tsx -u
yarn run v1.22.10
$ node scripts/jest /home/anan/work/OpenSearch-Dashboards/src/plugins/telemetry/public/components/opt_in_banner.test.tsx -u
 PASS  src/plugins/telemetry/public/components/opt_in_banner.test.tsx
  OptInDetailsComponent
    ✓ renders as expected (8 ms)
    ✓ fires the "onChangeOptInClick" prop with true when a enable is clicked (4 ms)
    ✓ fires the "onChangeOptInClick" with false when a disable is clicked (1 ms)

 › 1 snapshot updated.
Snapshot Summary
 › 1 snapshot updated from 1 test suite.

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   1 updated, 1 total
Time:        3.141 s

unit test for opt_in_message.test.tsx

yarn test:jest /home/anan/work/OpenSearch-Dashboards/src/plugins/telemetry/public/components/opt_in_message.test.tsx -u
yarn run v1.22.5
$ node scripts/jest /home/anan/work/OpenSearch-Dashboards/src/plugins/telemetry/public/components/opt_in_message.test.tsx -u
 PASS  src/plugins/telemetry/public/components/opt_in_message.test.tsx
  OptInMessage
    ✓ renders as expected (7 ms)

 › 1 snapshot updated.
Snapshot Summary
 › 1 snapshot updated from 1 test suite.

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   1 updated, 1 total
Time:        3.001 s

unit test for opted_in_notice_banner.test.tsx

yarn test:jest /home/anan/work/OpenSearch-Dashboards/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx -u
yarn run v1.22.5
$ node scripts/jest /home/anan/work/OpenSearch-Dashboards/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx -u
 PASS  src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx
  OptInDetailsComponent
    ✓ renders as expected (9 ms)
    ✓ fires the "onSeenBanner" prop when a link is clicked (2 ms)

 › 1 snapshot updated.
Snapshot Summary
 › 1 snapshot updated from 1 test suite.

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   1 updated, 1 total
Time:        3.025 s

Overall test result:
Screen Shot 2021-06-21 at 11 40 29 PM

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed d66fb64

tmarkley
tmarkley previously approved these changes Jun 22, 2021
@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 978b2e0

@ananzh ananzh changed the title [Test] Enable unit test suite:opt_in_banner.test.tsx [Test] Enable unit test suites in telemetry/public/components Jun 23, 2021
All the unit tests related to unused telemetry are temporarily
skipped after the fork. Unit tests of the disabled telemetry
functions should also be modified correspondingly. To build
a clean unit test, we decide to modify and enable all the
working unit tests. This PR enables three test suites in dir
src/plugins/telemetry/public/components, which includes:
1) opt_in_banner.test.tsx,
2) opt_in_message.test.tsx,
3) opted_in_notice_banner.test.tsx

Signed-off-by: Anan Zhuang <[email protected]>
@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 7741827

@kavilla kavilla self-requested a review June 23, 2021 22:44
@kavilla
Copy link
Member

kavilla commented Jun 23, 2021

LGTM but I have a question: I understand that we are just rendering the components without any logic. But are these components actually being used within the application?

@ananzh
Copy link
Member Author

ananzh commented Jun 25, 2021

LGTM but I have a question: I understand that we are just rendering the components without any logic. But are these components actually being used within the application?

Have no idea for now. But I can dive into it and see if an issue is needed.

@ananzh ananzh merged commit ec54d82 into opensearch-project:main Jun 25, 2021
kavilla pushed a commit that referenced this pull request Jun 26, 2021
All the unit tests related to unused telemetry are temporarily
skipped after the fork. Unit tests of the disabled telemetry
functions should also be modified correspondingly. To build
a clean unit test, we decide to modify and enable all the
working unit tests. This PR enables three test suites in dir
src/plugins/telemetry/public/components, which includes:
1) opt_in_banner.test.tsx,
2) opt_in_message.test.tsx,
3) opted_in_notice_banner.test.tsx

Signed-off-by: Anan Zhuang <[email protected]>
kavilla pushed a commit that referenced this pull request Jun 26, 2021
All the unit tests related to unused telemetry are temporarily
skipped after the fork. Unit tests of the disabled telemetry
functions should also be modified correspondingly. To build
a clean unit test, we decide to modify and enable all the
working unit tests. This PR enables three test suites in dir
src/plugins/telemetry/public/components, which includes:
1) opt_in_banner.test.tsx,
2) opt_in_message.test.tsx,
3) opted_in_notice_banner.test.tsx

Signed-off-by: Anan Zhuang <[email protected]>
@ananzh ananzh deleted the i-516 branch February 23, 2022 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants