rubyforgood / rubyforgood/casa

Improve test coverage in low-coverage controllers, notifications, and JavaScript

Open
#6,833 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

no-issue-activity
Dominant language
Ruby
Stars
381
Forks
542
Avg merge
3d 15h
Merged PRs (30d)
47

Description

Summary

An audit of test coverage identified several areas with significantly lower coverage than the project average (~91% Ruby line coverage). Every Ruby app file has a corresponding spec file, so the gaps are about depth of coverage, not missing files entirely.

Ruby Coverage Gaps

Controllers (target: match project average of 91%+)
File Current Coverage
app/controllers/learning_hour_topics_controller.rb 41.7%
app/controllers/learning_hour_types_controller.rb 41.7%
app/controllers/mileage_reports_controller.rb 44.4%
app/controllers/followup_reports_controller.rb 50.0%
Notifications
File Current Coverage
app/notifications/delivery_methods/sms.rb 43.8%
Policies
File Current Coverage
app/policies/custom_org_link_policy.rb 50.0%

JavaScript Coverage Gaps (46.75% overall)

File Line Coverage
app/javascript/src/case_emancipation.js 17.3%
app/javascript/src/case_contact.js 20%
app/javascript/src/casa_case.js 21%
app/javascript/src/dashboard.js 22.7%
app/javascript/src/session_timeout_poller.js 43.8%
app/javascript/src/require_communication_preference.js 50%

There are also 2 failing Jest tests in validated_form.test.js (color format mismatch: rgb() vs hex).

Suggested approach

  • Controllers: Add request specs or system tests covering untested actions (per ADR 0006, system tests are preferred)
  • Notifications/Policies: Add unit specs for uncovered branches
  • JavaScript: Add Jest tests for the 4 files under 25% coverage as the highest-value targets
  • Jest failures: Fix the 2 failing assertions in validated_form.test.js

How to reproduce

# Ruby coverage report
RUN_SIMPLECOV=true bundle exec rspec
open coverage/index.html

# JavaScript coverage
npx jest --coverage

# Check for missing spec files
bundle exec rake test_checker

Notes

  • lib/tasks directory is at 49.7% but most of those are one-time deployment rake tasks — lower priority
  • Coverage data is from the last SimpleCov run; re-run to get current numbers

Contributor guide

Open the contributing guide

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.

Research direction

Start by running the Ruby and JavaScript coverage commands in the issue, then inspect the listed controller, notification, policy, and JavaScript files alongside their existing specs. Prioritize the four JavaScript files below 25% coverage or a smaller Ruby area, following ADR 0006 for controller tests. Done means added tests cover the selected branches and the relevant test suite passes, including the validated_form.test.js failures if addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rails, ruby
Domain
backend, frontend, testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.