Skip to content

WEB-1430: Fix the two Jest specs failing on dev - #4261

Merged
IOhacker merged 3 commits into
openMF:devfrom
devvaansh:WEB-1430-fix-failing-jest-specs
Nov 10, 2026
Merged

IOhacker merged 3 commits into
openMF:devfrom
devvaansh:WEB-1430-fix-failing-jest-specs

Conversation

@devvaansh

@devvaansh devvaansh commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Description

Two Jest specs have been failing on dev without anyone noticing. The Unit Tests (Jest) step runs with continue-on-error, so the check stays green; the latest dev run shows 2 failed, 303 passed. In both cases a later production change left the spec's test setup behind. The app code is fine, so this PR only touches the two specs.

With dev green, #3957 can remove continue-on-error and the Jest check will block merges again. Coverage reporting (#4249) also depends on that.

What changes:

  1. create-gsim-account.charges.spec.ts: WEB-1388 (WEB-1388: Create one GSIM account per GSIM application and open it after submitting #4211) made CreateGsimAccountComponent inject GroupsService. This spec, added by WEB-1390 (WEB-1390: Send the charge dates of a GSIM application #4213) seven minutes earlier, never provided it, so every run failed with NG0201: No provider found for HttpClient. It now provides a GroupsService stub, as the sibling create-gsim-account.component.spec.ts does. Only submit() uses that service, and building the request bodies never calls it.
  2. prepay-loan.component.spec.ts: WEB-657 made LoanAccountActionsBaseComponent build its navigation from route.pathFromRoot. The spec's route stub had no pathFromRoot, so after a contract termination the navigation threw and router.navigate was never called. The spec now uses the same :loanId/actions/:action route stub as the Working Capital prepay spec. It also asserts where the app goes (the loan's general tab, relative to the loans route, with productType) instead of only counting calls. A bare pathFromRoot: [] would pass even if the navigation went to the wrong URL.

There are no app source changes.

Verification:

Check Result
The two specs and the sibling GSIM spec 3 suites, 16 of 16 tests pass
Full jest --ci 304 of 305 suites pass. The remaining one, pentaho.component.spec.ts ("decodes a report whose charset is quoted"), fails only under my local Homebrew Node 24.7 build, whose TextDecoder('windows-1252') maps 0x80 to U+0080 instead of €. It passes in dev's CI.
Put the base component's navigation back to ../../general The updated prepay test fails, so it now guards the WEB-657 behaviour
Contract termination from the app (ng serve with proxy.localhost.conf.js) against Fineract develop (4a61d7c), on an active progressive loan The form posts {transactionDate, externalId, note, dateFormat, locale} to /loans/2?command=contractTermination (the payload the spec asserts). Fineract returns 200 and sets the sub-status to contractTermination. The app lands on /#/clients/3/loans-accounts/2/general?productType=loan.
GSIM application with the charge shape the GSIM spec asserts, against the same Fineract POST /savingsaccounts/gsim with two members returns 200 and creates one GSIM account. Both member accounts store the due date, fee day and fee interval as sent. GET /groups/{id}/gsimaccounts returns the new gsimId, which is the lookup submit() does through GroupsService.
prettier --check and eslint on both files Pass

Related issues and discussion

https://mifosforge.jira.com/browse/WEB-1430

Screenshots, if any

None. This PR only changes tests.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • If you have multiple commits please combine them into one commit by squashing them.

  • Read and understood the contribution guidelines at web-app/.github/CONTRIBUTING.md.

Summary by CodeRabbit

  • Tests
    • Updated automated checks for loan prepayment navigation, including routing to the loan’s general tab with the appropriate product type.
    • Adjusted GSIM account charge test setup to include the service used during submission.
    • These changes improve test coverage and reliability; no end-user-facing behavior changes are included.

@devvaansh
devvaansh requested a review from a team November 9, 2026 12:37
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: openMF/web-app
  • Branch: dev
  • File: .coderabbit.yaml
  • Commit: a52d3f2
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 12bdb2a8-1151-434d-8e1a-97e153a57133
Commits

Reviewing files that changed from the base of the PR and between 09b585d and b83739e.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "pre_merge_checks"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review.

Walkthrough

Two specs update test setup. The prepay loan spec adds an action-route stub and checks the expected navigation target. The GSIM charges spec adds a GroupsService mock.

Changes

Prepay Loan Navigation Test

Layer / File(s) Summary
Action route and navigation assertion
src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.spec.ts
The spec uses an action-route stub with a parent route and pathFromRoot. It checks navigation to loan 1’s general tab relative to the parent, with the productType: 'loan' query parameter.

GSIM Charges Test Setup

Layer / File(s) Summary
GroupsService test provider
src/app/savings/gsim-account/create-gsim-account/create-gsim-account.charges.spec.ts
The spec imports GroupsService and adds an empty mock to the test providers.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: gkbishnoi07, budaidev

Merge Risk: Minimal · previous review e0244

The changes update test setup and navigation coverage. No actionable merge-blocking risk is established.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the ticket (WEB-1430) and says the change fixes two failing Jest specs on dev. The changeset only edits two spec files: the prepay-loan spec gets a route stub with pathFromRoot and a n…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the ticket (WEB-1430) and says the change fixes two failing Jest specs on dev. The changeset only edits two spec files: the prepay-loan spec gets a route stub with pathFromRoot and a navigation assertion, and the GSIM charges spec gets a GroupsService mock. The title names the main purpose of the change and is specific enough for a teammate scanning history.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: openMF/web-app
  • Branch: dev
  • File: .coderabbit.yaml
  • Commit: 1c99a71
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7fe00d02-2dba-4fb3-982f-d11e27062f4f
Commits

Reviewing files that changed from the base of the PR and between 1c99a71 and e024465.

Files selected for processing: 2

  • src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.spec.ts
  • src/app/savings/gsim-account/create-gsim-account/create-gsim-account.charges.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

- create-gsim-account.charges.spec.ts: provide GroupsService, which the
  component injects since WEB-1388.
- prepay-loan.component.spec.ts: stub the :loanId/actions/:action route
  with pathFromRoot, which the base component navigates from since
  WEB-657, and assert the loan general tab it lands on.
@IOhacker
IOhacker merged commit 4263c0a into openMF:dev Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants