Skip to content

test: fix unit tests for csv.ts (csvCell and toCsv)#2877

Open
yachikadev wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
yachikadev:test/csv-unit-tests
Open

test: fix unit tests for csv.ts (csvCell and toCsv)#2877
yachikadev wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
yachikadev:test/csv-unit-tests

Conversation

@yachikadev

Copy link
Copy Markdown
Contributor

Summary

Fixes the existing unit tests in test/csv.test.ts for CSV serialisation
utilities exported from src/lib/csv.ts.

Closes #2804

Changes Made

  • Fixed incorrect expectation in toCsv single-row test case
    • Previous: expected header row only ("name,age")
    • Fixed: expects header + data row ("name,age\nAlice,30") which matches
      actual implementation behaviour

Why

The existing test assumed toCsv with a single row returns only headers.
But the implementation always appends data rows — even for a single row.
The wrong expectation would have caused CI to fail.

Test Coverage (already present, now correct)

All requirements from issue #2804 are covered:

  • csvCell: null/undefined, plain text, comma, double-quote, newline, carriage return
  • toCsv: empty array, single row, multiple rows, missing keys, numbers/booleans

@github-actions github-actions Bot added type:testing GSSoC type bonus: tests (+10 pts) gssoc26 GSSoC 2026 contribution labels Jun 27, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@yachikadev

Copy link
Copy Markdown
Contributor Author

The Playwright smoke test failure is not related to this PR.
It is caused by a pnpm-lock.yaml lockfile mismatch with the current overrides config in package.json — a pre-existing repo issue. All checks relevant to this PR pass successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for csv.ts

1 participant