feat(sp7): MatchedRemitCard — line-count badge

This commit is contained in:
Tyler
2026-06-20 19:47:11 -06:00
parent 00cdd068fc
commit b538c0939b
3 changed files with 80 additions and 0 deletions
@@ -138,6 +138,61 @@ describe("MatchedRemitCard", () => {
unmount();
});
it("test_full_match_badge_renders_when_matchedLines_equals_totalLines", () => {
const { container, unmount } = renderIntoContainer(
<MatchedRemitCard
matchedRemittance={makeMatchedRemittance({
matchedLines: 4,
totalLines: 4,
})}
/>
);
const badge = container.querySelector(
'[data-testid="matched-remit-line-counts"]'
);
expect(badge).not.toBeNull();
expect(badge?.textContent ?? "").toMatch(/4\/4 matched/);
expect(badge?.getAttribute("data-all-matched")).toBe("true");
unmount();
});
it("test_partial_match_badge_renders_unmatched_count", () => {
const { container, unmount } = renderIntoContainer(
<MatchedRemitCard
matchedRemittance={makeMatchedRemittance({
matchedLines: 3,
totalLines: 4,
})}
/>
);
const badge = container.querySelector(
'[data-testid="matched-remit-line-counts"]'
);
expect(badge).not.toBeNull();
expect(badge?.textContent ?? "").toMatch(/3\/4 matched/);
expect(badge?.textContent ?? "").toMatch(/1 unmatched/);
expect(badge?.getAttribute("data-all-matched")).toBe("false");
unmount();
});
it("test_badge_omitted_when_line_counts_undefined", () => {
// Backward compatibility: pre-SP7 claim-detail responses don't
// include matchedLines / totalLines. The card should still render
// without the badge.
const { container, unmount } = renderIntoContainer(
<MatchedRemitCard
matchedRemittance={makeMatchedRemittance({
matchedLines: undefined,
totalLines: undefined,
})}
/>
);
expect(
container.querySelector('[data-testid="matched-remit-line-counts"]')
).toBeNull();
unmount();
});
it("test_view_remittance_link_sets_window_location_href", () => {
// Spy on the `href` setter so the click doesn't actually navigate
// away in the test runner, and so we can assert what was assigned.