diff options
author | 2023-03-07 12:22:34 -0800 | |
---|---|---|
committer | 2023-03-07 12:22:34 -0800 | |
commit | f7e4eb83694aa007a492ef66c28ffbe6a2dae791 (patch) | |
tree | 7af25aa5c42a2e1b2b47ba1df35f8caa9054cbeb /test/bun.js/sql-raw.test.js | |
parent | 36275a44ce7a33587bd26aad120042ab95470ff3 (diff) | |
download | bun-f7e4eb83694aa007a492ef66c28ffbe6a2dae791.tar.gz bun-f7e4eb83694aa007a492ef66c28ffbe6a2dae791.tar.zst bun-f7e4eb83694aa007a492ef66c28ffbe6a2dae791.zip |
Reorganize tests (#2332)
Diffstat (limited to 'test/bun.js/sql-raw.test.js')
-rw-r--r-- | test/bun.js/sql-raw.test.js | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/test/bun.js/sql-raw.test.js b/test/bun.js/sql-raw.test.js deleted file mode 100644 index 9b6312dda..000000000 --- a/test/bun.js/sql-raw.test.js +++ /dev/null @@ -1,55 +0,0 @@ -import { expect, it } from "bun:test"; - -var SQL = globalThis[Symbol.for("Bun.lazy")]("sqlite"); -const dbPath = import.meta.dir + "/northwind.testdb"; - -it("works", () => { - const handle = SQL.open(dbPath); - - const stmt = SQL.prepare(handle, 'SELECT * FROM "Orders" WHERE OrderDate > date($date)'); - expect(stmt.toString()).toBe(`SELECT * FROM "Orders" WHERE OrderDate > date(NULL)`); - - expect( - Array.isArray( - stmt.all({ - // do the conversion this way so that this test runs in multiple timezones - $date: new Date(new Date(1996, 8, 1, 0, 0, 0, 0).toUTCString()).toISOString(), - }), - ), - ).toBe(true); - expect(stmt.toString()).toBe(`SELECT * FROM "Orders" WHERE OrderDate > date('1996-09-01T07:00:00.000Z')`); - - var ran = stmt.run({ - $date: new Date(new Date(1997, 8, 1, 0, 0, 0, 0).toUTCString()).toISOString(), - }); - expect(Array.isArray(ran)).toBe(false); - expect(ran === undefined).toBe(true); - expect(stmt.toString()).toBe(`SELECT * FROM "Orders" WHERE OrderDate > date('1997-09-01T07:00:00.000Z')`); - - expect( - Array.isArray( - stmt.get({ - $date: new Date(new Date(1998, 8, 1, 0, 0, 0, 0).toUTCString()).toISOString(), - }), - ), - ).toBe(false); - expect(stmt.toString()).toBe(`SELECT * FROM "Orders" WHERE OrderDate > date('1998-09-01T07:00:00.000Z')`); - expect(stmt.paramsCount).toBe(1); - expect(stmt.columnsCount).toBe(14); - expect(stmt.columns.length).toBe(14); - stmt.finalize(); - SQL.close(handle); -}); - -it("SQL.run works", () => { - const handle = SQL.open(dbPath); - expect(typeof handle).toBe("number"); - - expect( - SQL.run(handle, 'SELECT * FROM "Orders" WHERE OrderDate > date($date)', { - $date: new Date(1996, 8, 1).toISOString(), - }), - ).toBe(undefined); - - SQL.close(handle); -}); |