Skip to content

fix: make committee analysis test assertions less fragile to wording changes - #433

Merged
pethers merged 2 commits into
news/committee-reports-2026-03-09-d82c3dcaa778b7c7from
copilot/sub-pr-424
Mar 9, 2026
Merged

fix: make committee analysis test assertions less fragile to wording changes#433
pethers merged 2 commits into
news/committee-reports-2026-03-09-d82c3dcaa778b7c7from
copilot/sub-pr-424

Conversation

Copilot AI commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Tests in test/unit/deep-analysis.test.js hard-coded full English sentences from localized copy, making them brittle to any wording change in COMMITTEE_ANALYSIS_CONTENT_STRINGS.

Changes

  • buildCommitteeAnalysis — productivity test: Split '0% active rate signals low legislative productivity' into two independent partial checks so a change to either the template or the productivityLow value only breaks one assertion:

    // before
    expect(result.why).toContain('0% active rate signals low legislative productivity');
    
    // after
    expect(result.why).toContain('0% active rate');
    expect(result.why).toContain('low legislative productivity');
    expect(result.why).not.toContain('moderate');
  • buildCommitteeAnalysisimpactPoliticalNone test: Replaced exact-phrase check with a short partial string + baseline comparison, decoupling the test from sentence structure:

    // before
    expect(result.impactAssessment.political).toContain('No committees have published recent documents');
    expect(result.impactAssessment.political).not.toContain('Active committees');
    
    // after
    const baseline = buildCommitteeAnalysis(COMMITTEE_DATA, '2026-02-24');
    expect(result.impactAssessment.political).toContain('No committees');
    expect(result.impactAssessment.political).not.toBe(baseline.impactAssessment.political);

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…changes

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title [WIP] Add committee-reports articles for 14 languages fix: make committee analysis test assertions less fragile to wording changes Mar 9, 2026
@pethers
pethers marked this pull request as ready for review March 9, 2026 15:42
@pethers
pethers merged commit a6a1022 into news/committee-reports-2026-03-09-d82c3dcaa778b7c7 Mar 9, 2026
@pethers
pethers deleted the copilot/sub-pr-424 branch March 9, 2026 15:42
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