Skip to content

test: add coverage for chartToTable (lib/tools/chart-util.ts) - #35

Merged
charandeep-reddy merged 3 commits into
charandeep-reddy:mainfrom
webdevsamran:test/chart-util-coverage
Aug 16, 2026
Merged

charandeep-reddy merged 3 commits into
charandeep-reddy:mainfrom
webdevsamran:test/chart-util-coverage

Conversation

@webdevsamran

Copy link
Copy Markdown
Contributor

Summary

Adds tests/chart-util.test.ts with a dedicated unit test suite for chartToTable in src/lib/tools/chart-util.ts (resolving #24).

Tests Covered

  • Pie charts (type: "pie"):

    • Standard pie chart spec conversion with name/value columns and mapped rows.
    • Pie chart specs with missing or empty data arrays.
  • Cartesian charts (type: "bar" / type: "line"):

    • Bar charts with xLabels and multiple series.
    • Line charts with single or multiple series.
    • Fallback to 1-indexed string row numbers ("1", "2", ...) when xLabels is missing.
    • Edge case: Empty series array.
    • Edge case: Shorter series data array (pads missing values with null).
    • Edge case: Longer series data array (asserts current behavior that rows walk series[0].data).

Validation

  • bun run test chart-util — 8 tests passed
  • bun run typecheck — clean
  • bun run lint — clean
  • bun run test — 304 tests passed across 28 test files

Closes #24

@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

@webdevsamran is attempting to deploy a commit to the charan Team on Vercel.

A member of the Team first needs to authorize it.

@charandeep-reddy
charandeep-reddy merged commit b210a17 into charandeep-reddy:main Aug 16, 2026
1 of 2 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.

Add tests for chartToTable (lib/tools/chart-util.ts)

2 participants