From 31cc9360a71257272f20f4e3eb5f40ec3094f4fe Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Wed, 26 Jun 2024 20:35:20 +0900 Subject: [PATCH] test(csv): improve CsvStringifyStream test --- csv/csv_stringify_stream_test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/csv/csv_stringify_stream_test.ts b/csv/csv_stringify_stream_test.ts index 1eb019ac112a..e9e522a614c6 100644 --- a/csv/csv_stringify_stream_test.ts +++ b/csv/csv_stringify_stream_test.ts @@ -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" },