test(csv): improve CsvStringifyStream test (#5154)

This commit is contained in:
Yoshiya Hinosawa 2024-06-27 12:47:27 +09:00 committed by GitHub
parent ba256e3579
commit 9144a6253c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,6 +57,18 @@ Deno.test({
);
});
await t.step("with invalid `columns`", async () => {
const readable = ReadableStream.from([
["one", "two", "three"],
// deno-lint-ignore no-explicit-any
]).pipeThrough(new CsvStringifyStream({ columns: { length: 1 } as any }));
await assertRejects(
async () => await Array.fromAsync(readable),
StringifyError,
"No property accessor function was provided for object",
);
});
await t.step("with objects", async () => {
const readable = ReadableStream.from([
{ id: 1, name: "foo" },