Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1467: Add test that this works in regular duckdb-wasm #1468

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions packages/duckdb-wasm/test/regression/github_1467.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as duckdb from '../../src';

// https://github.com/duckdb/duckdb-wasm/issues/477
// Note that when ArrowJS supports negative decimals, castDecimalToDouble should probably be deprecated.
export function test1467(db: () => duckdb.AsyncDuckDB): void {
let conn: duckdb.AsyncDuckDBConnection | null = null;
beforeEach(async () => {
await db().flushFiles();
});
afterEach(async () => {
if (conn) {
await conn.close();
conn = null;
}
await db().flushFiles();
await db().dropFiles();
});
describe('GitHub issues', () => {
it('1467', async () => {
// Baseline without cast: we expect decimal values to not handle fractional parts correctly
await db().open({
path: ':memory:',
query: {},
});
conn = await db().connect();
const resultWithoutCast = await conn.query(`select substring('🦆🦆🦆' from 3) AS result;`);
expect(resultWithoutCast.toArray()[0]?.result).toEqual('🦆');
});
});
}
4 changes: 3 additions & 1 deletion packages/duckdb-wasm/test/regression/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { test334 } from './github_334.test';
import { test393 } from './github_393.test';
import { test448 } from './github_448.test';
import { test470 } from './github_470.test';
import { test477 } from "./github_477.test";
import { test477 } from './github_477.test';
import { test1467 } from './github_1467.test';

export function testRegressionAsync(adb: () => duckdb.AsyncDuckDB): void {
test332(adb);
Expand All @@ -13,4 +14,5 @@ export function testRegressionAsync(adb: () => duckdb.AsyncDuckDB): void {
test448(adb);
test470(adb);
test477(adb);
test1467(adb);
}