forked from duckdb/duckdb-wasm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 1467: Add test that this works in regular duckdb-wasm
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as duckdb from '../../src'; | ||
import * as arrow from 'apache-arrow'; | ||
|
||
// 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('🦆'); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters