Add unit-test coverage for app/sagas/

Open
#7,341 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
70/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript, react-native, typescript

Research direction

Start with the existing tests in app/sagas/tests/videoConf.voipBlock.test.ts and deepLinking.test.ts, then inspect app/sagas/login.js and its root() watcher. Set up the suggested runSaga or expectSaga harness and cover the SERVER.SELECT_REQUEST and timeout cases. Done means the root watcher behavior is asserted and the new tests pass.

Written by the indexing model from the issue text.

Description

✅ needs tests type: feature

Background

app/sagas/ has just two existing tests (videoConf.voipBlock.test.ts, deepLinking.test.ts). Core sagas — login.js, init.js, rooms.js, messages.js, encryption.js, state.js, selectServer.ts, room.js — have no direct unit-test coverage.

Motivating example

NATIVE-1180 / #7333 / #7340: an unconditional cancel(loginSuccessTask) in login.js's root() watcher imposed a hard 2-second deadline on handleLoginSuccess and stranded users on the login screen when permission/enterprise fetches ran long. The bug lived in root()'s cancel logic for ~3 weeks before a user reported it.

A small saga harness asserting that cancel(loginSuccessTask) only fires when SERVER.SELECT_REQUEST wins the race would have failed loudly the moment the regression landed.

Suggested scope

  • Set up a saga test harness under app/sagas/__tests__/ using runSaga or expectSaga from @redux-saga/testing-utils.
  • First pass: cover the root() watcher in login.js — SERVER.SELECT_REQUEST cancels handleLoginSuccess; 2s timeout does not.
  • Subsequent passes: high-traffic sagas (init.js, selectServer.ts, rooms.js).

Non-goals

  • Not aiming for 100% saga coverage. Pick the seams where regressions are most costly (auth, server switch, deep links, rooms sync).
Dominant language
TypeScript
Stars
2.4k
Forks
1.5k
Avg merge
1d 15h
Merged PRs (30d)
29

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RocketChat/Rocket.Chat.ReactNative

All issues in RocketChat/Rocket.Chat.ReactNative

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.