couple of corrections, new additions

This commit is contained in:
2024-04-01 18:20:57 -05:00
parent 2e7f4833a7
commit 7b35e8335c
7 changed files with 161 additions and 3 deletions

View File

@@ -1,3 +1,19 @@
import { describe, assert, it } from "vitest";
import { readCSVToType } from "../pkg/csv";
import { z } from "zod";
describe('readCSVToType', () => {
it('should read a CSV string into an array of objects', async () => {
const result = await readCSVToType("a,b,c\n1,2,3", z.object({
a: z.coerce.number(),
b: z.coerce.number(),
c: z.coerce.number(),
}));
console.log(result);
assert(result[0].a === 1);
assert(result[0].b === 2);
assert(result[0].c === 3);
})
})