Skip to content

docs: Add window.localStorage.remove('token') statement to afterEach() in tests/login.js file #709

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

Merged
merged 1 commit into from
Jun 15, 2020

Conversation

2dubbing
Copy link
Contributor

@2dubbing 2dubbing commented Jun 15, 2020

What:
You need to add window.localStorage.removeItem('token') to afterEach() within 'tests/login.js' file in Complex Example in README.md file.

Why:
The token value exists in localstorage due to the first test suite. This causes the second test suite to fail.

How:
Adding window.localStorage.removeItem('token') code to the afterEach() callback function argument solved the problem.

Checklist:

  • Documentation added to the
    docs site
  • Tests
  • Typescript definitions updated
  • Ready to be merged

…) in __tests__/login.js file

Due to the first test suite, I need to remove the token value generated from local storage.
The second test suite will fail if the token value is not removed.
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a03ab41:

Sandbox Source
elegant-driscoll-rcx84 Configuration
nifty-flower-bfgr1 Configuration

@2dubbing 2dubbing changed the title docs: Add window.localStorage.remove('token') statement to afterEach(… docs: Add window.localStorage.remove('token') statement to afterEach() in tests/login.js file Jun 15, 2020
@codecov
Copy link

codecov bot commented Jun 15, 2020

Codecov Report

Merging #709 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #709   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          100       100           
  Branches        16        16           
=========================================
  Hits           100       100           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd89e1e...a03ab41. Read the comment docs.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Good call! Thanks.

@kentcdodds kentcdodds merged commit 872bd6a into testing-library:master Jun 15, 2020
@kentcdodds
Copy link
Member

@all-contributors please add @2dubbing for docs

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @2dubbing! 🎉

@kentcdodds
Copy link
Member

🎉 This PR is included in version 10.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants