community-platform icon indicating copy to clipboard operation
community-platform copied to clipboard

chore: deal with jest console warnings

Open Robert-LC opened this issue 10 months ago • 1 comments

PR Checklist

PR Type

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [x] Developer experience (improves developer workflows for contributing to the project)

Description

I dealt with most of the Jest console warnings as well as the unnecessary logging appearing.

  • For logger itself, I expected the test log entries of debug, info, warn, fatal instead of displaying them.

  • For Message.store.tsx I removed the logger.error calls because the test looks for Errors thrown so no need to cloud the logging, if the tests will fail in that regard.

  • For files that called logger.info, I switched to logger.debug instead to hide the calls in the tests, but keep them around for debugging. Let me know if you think this what the right choice for those items.

  • There were a few tests like in user.store.test.tsx where it was testing for if two users were returned form the same id and it would return a warning, but if it wouldn't cause a failure of the test.

So for those type of scenarios, I decided to mock the warning to hide from the test suite, since its not failing on expect. Let me know if you want something different in that scenario.

Lastly, while trying to figure out the best approach, I noticed that in functions/src/test/firebase/logger.ts there was at one point a top level mock that spied on all firebase logger methods

Git Issues

Closes #3303

Robert-LC avatar Apr 02 '24 20:04 Robert-LC

1 failed test on run #5361 ↗︎

1 97 0 0 Flakiness 0

Details:

chore: deal with jest console warnings
Project: onearmy-community-platform Commit: 7315692b72
Status: Failed Duration: 04:36 💡
Started: Apr 2, 2024 8:23 PM Ended: Apr 2, 2024 8:28 PM
Failed  src/integration/settings.spec.ts • 1 failed test • ci-chrome

View Output Video

Test Artifacts
[Settings] > [All account types > [Can update username and password] Test Replay Screenshots Video

Review all test suite changes for PR #3410 ↗︎

cypress[bot] avatar Apr 02 '24 20:04 cypress[bot]

Hey @Robert-LC hope you're well, will you have a chance to have a look at this again soon?

benfurber avatar May 09 '24 15:05 benfurber