From b4b574de4294df6c59dd11935f7c673406f9eba9 Mon Sep 17 00:00:00 2001 From: Jeff Raymakers Date: Fri, 22 Dec 2023 16:31:40 -0800 Subject: [PATCH] add union type to all_types test --- packages/duckdb-wasm/test/all_types.test.ts | 22 ++++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/duckdb-wasm/test/all_types.test.ts b/packages/duckdb-wasm/test/all_types.test.ts index c3668203a..aec494169 100644 --- a/packages/duckdb-wasm/test/all_types.test.ts +++ b/packages/duckdb-wasm/test/all_types.test.ts @@ -80,7 +80,7 @@ const FULLY_IMPLEMENTED_ANSWER_MAP: AnswerObjectType = { // Note that we multiply by thousand (and add 999 for the max) because the value returned by DuckDB is in microseconds, // whereas the Date object is in milliseconds. time: [BigInt(0), BigInt(new Date('1970-01-01T23:59:59.999+00:00').valueOf()) * BigInt(1000) + BigInt(999), null], - interval: [new Int32Array([0,0]), new Int32Array([0,0]), null], + interval: [new Int32Array([0, 0]), new Int32Array([0, 0]), null], float: [-3.4028234663852886e38, 3.4028234663852886e38, null], double: [-1.7976931348623157e308, 1.7976931348623157e308, null], @@ -112,6 +112,8 @@ const FULLY_IMPLEMENTED_ANSWER_MAP: AnswerObjectType = { Uint8Array.from([0, 0, 0, 97]), null, ], + + union: ['Frank', 5, null], }; // Replacements for the values we knowingly don't support from the test_all_types query @@ -215,22 +217,19 @@ export function testAllTypes(db: () => duckdb.DuckDBBindings): void { } for (let i = 0; i < results.numCols; i++) { const name = results.schema.fields[i].name; - if (name == "bit") - continue; + if (name == 'bit') continue; const col = results.getChildAt(i); if (skip.get(name)) continue; expect(col).not.toBeNull(); expect(col?.length).not.toEqual(0); expect(unpack(getValue(col!.get(0)))) - .withContext(name) - .toEqual(test.answerMap[name][0]); // Min + .withContext(name) + .toEqual(test.answerMap[name][0]); // Min expect(unpack(getValue(col!.get(1)))) - .withContext(name) - .toEqual(test.answerMap[name][1]); // Max - expect(col!.get(2)) - .withContext(name) - .toEqual(test.answerMap[name][2]); // Null + .withContext(name) + .toEqual(test.answerMap[name][1]); // Max + expect(col!.get(2)).withContext(name).toEqual(test.answerMap[name][2]); // Null } }); } @@ -267,8 +266,7 @@ export function testAllTypesAsync(db: () => duckdb.AsyncDuckDB): void { } for (let i = 0; i < results.numCols; i++) { const name = results.schema.fields[i].name; - if (name == "bit") - continue; + if (name == 'bit') continue; const col = results.getChildAt(i); if (skip.get(name)) continue; expect(col).not.toBeNull();