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

Add unit tests for helpers methods #519

Closed
wants to merge 8 commits into from

Conversation

kararade
Copy link
Contributor

@kararade kararade commented Apr 16, 2020

Release Type: Dev Improvement

Fixes https://github.com/x-team/xp/issues/2017

Description

Unit tests added for the helper methods of XP-UI

Checklist

Before submitting a pull request, please make sure the following is done:

  • set yourself as an assignee
  • set appropriate labels for a PR (In Review or In Progress depending on its status)
  • make sure your code lints (npm run lint)
  • Flow typechecks passed (npm run flow)
  • Snapshots tests passed (npm run jest) (NOTE: This is temporarily disabled. Skip it.)
  • check cleanup tasks (https://github.com/x-team/xp/labels/cleanup) and take a suitable small one (if exists) in a related area of the current changes
  • if any snapshots have been changed, verify that component still works and looks as expected and update the changed snapshot (NOTE: This is temporarily disabled. Skip it.)
  • once finished with all the changes, you run npm run build command and committed changed files to the branch
  • manually tested the app by running it in several different browsers (Firefox, Chrome, Opera, Safari, MS IE/Edge, etc.) and checked nothing is broken and operates as expected!

Steps to Test or Reproduce

  1. Run rm -r node_dependencies && npm i
  2. Run npm run jest
  3. Confirm that the unit tests added for the helpers methods all pass

Screen Shot on 2020-04-17 at 01:31:27

Impacted Areas in Application

  • src/utils/helpers.js - added comments and removed dead methods
  1. getOlderBrowserErrorKey()- refactored
  2. timeSince()- refactored
  • _tests_/utils/helpers.spec.js - created
  • .jest/setupTests.js - refactored

Screenshots

  1. Affected by timeSince() helper method refactored
  • /src/components/ui/ActivityBar.js

Screen Shot on 2020-04-17 at 00:57:53

  • /src/components/ui/Email.js

Screen Shot on 2020-04-17 at 00:58:16

Screen Capture on 2020-04-17 at 00-59-22

  • /src/components/ui/EmailFeed.js

Screen Capture on 2020-04-17 at 01-01-16

  • /src/components/ui/Note.js

Screen Shot on 2020-04-17 at 01:02:43

Screen Shot on 2020-04-17 at 01:03:00

  1. Affected by getOlderBrowserErrorKey() helper method refactored
  • /src/components/ui/ErrorBox.js

Screen Capture on 2020-04-17 at 01-08-57

Copy link
Collaborator

@nicksp nicksp left a comment

Choose a reason for hiding this comment

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

Let's clean up a little bit.

src/utils/helpers.js Outdated Show resolved Hide resolved
src/utils/helpers.js Outdated Show resolved Hide resolved
src/utils/helpers.js Outdated Show resolved Hide resolved
src/utils/helpers.js Outdated Show resolved Hide resolved
src/utils/helpers.js Outdated Show resolved Hide resolved
src/utils/helpers.js Outdated Show resolved Hide resolved
src/utils/helpers.js Outdated Show resolved Hide resolved
src/__test__/utils/helpers.spec.js Outdated Show resolved Hide resolved
src/__test__/utils/helpers.spec.js Outdated Show resolved Hide resolved
src/__test__/utils/helpers.spec.js Outdated Show resolved Hide resolved
@kararade kararade force-pushed the CLEANUP-2017-helpers-unit-tests branch 2 times, most recently from 3f01e4e to 51fccae Compare April 21, 2020 17:00
@kararade kararade force-pushed the CLEANUP-2017-helpers-unit-tests branch from 51fccae to 2b0ddac Compare April 21, 2020 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants