Skip to content

test: cover import, avatars, and chart theme; restore coverage gates - #107

Merged
austenstone merged 4 commits into
mainfrom
fix/coverage
Aug 20, 2026
Merged

test: cover import, avatars, and chart theme; restore coverage gates#107
austenstone merged 4 commits into
mainfrom
fix/coverage

Conversation

@austenstone

Copy link
Copy Markdown
Owner

Closes #95.

Stacked on #106.

import.ts had zero coverage and the bot-avatar code in formatters.ts was effectively untestable, because this jsdom setup exposes no localStorage — so cache hydration and persistence silently no-op'd inside their try/catch.

What's covered now

Module Before After (stmts)
import.ts 0% 100%
formatters.ts 52.4% 74.2%
chart-theme.ts 90.5% 98.3%

Thresholds go back to the 80/70/80/65 the issue asked for. Actual is 88.2 statements / 73.2 branches / 88.1 functions / 90.8 lines, so there's real headroom rather than a gate pinned to the current number.

Two things worth knowing

The ZIP fixture is a prebuilt base64 blob rather than something the test builds. fflate's zipSync can't produce a valid archive under jsdom: its instanceof Uint8Array check fails across realms, so it walks the byte array as a nested directory and emits entries like a.csv/0/, a.csv/1/. The same call in plain Node produces a correct 117-byte archive. unzipSync is unaffected, and that's the only half the app uses, so this is a test-environment artifact and not a product bug.

The zip.ts coverage-exclusion comment blamed File.arrayBuffer() not existing in jsdom. It does exist and works — I checked, it returned the bytes. zipSync is the actual blocker, so the comment now says so.

285 tests pass, 0 lint errors, 0 type errors.

austenstone and others added 2 commits August 20, 2026 09:23
…gates

Closes #95.

- import.ts had no tests at all. Covers CSV, ZIP, non-CSV skip, and
  per-entry failure isolation. The ZIP fixture is prebuilt because
  fflate's zipSync can't produce a valid archive under jsdom — its
  Uint8Array check fails across realms and it walks the byte array as a
  nested directory. The read path is unaffected, which is what the app
  actually uses on import.

- The bot avatar code was untested because this jsdom setup exposes no
  localStorage, so cache hydration and persistence silently no-op'd.
  Installing an in-memory Storage exercises them, along with request
  dedupe, the concurrency queue, the 10-lookup batch cap, and failure
  handling.

- buildGitHubChartTheme now covers both the CSS-variable path and the
  bundled-palette fallback.

Thresholds go back to the 80/70/80/65 the issue asked for. Actual is
88.2 statements / 73.2 branches / 88.1 functions / 90.8 lines.

Also corrects the zip.ts coverage-exclusion comment, which blamed
File.arrayBuffer(); that works fine here, zipSync is the problem.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Org-level Copilot seat exports have no Organization column, but the seat
activity schema defaults to grouping by it. The fallback couldn't help
because the fallback was the broken column, so the chart came up empty.

Validate each candidate in turn — current column, schema default, then
the report's primary dimension — instead of trusting the default.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Switching pages in the sidebar reset the grouping to the schema default
without checking the active report actually has that column. On an
org-level seat export, which has no Organization column, that put the
page straight back into the empty-chart state the upload path had just
avoided.

Resolve against the report being switched to. Verified against a
five-column org-level export: the chart now renders per-login seats
instead of coming up blank.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@austenstone
austenstone changed the base branch from fix/sample-data to main August 20, 2026 17:25
@austenstone
austenstone merged commit a0d9518 into main Aug 20, 2026
3 checks passed
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.

Tech debt: raise coverage thresholds back to 80/70/80/65 by adding tests

1 participant