-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add schema and is_schema options to db create method (#15)
* feat: add schema and is_schema options to db create method * feat: add new fields to formatted response * feat: throw error if is_schema nd schema used
- Loading branch information
Showing
2 changed files
with
46 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,25 @@ | ||
import { describe, it, expect, vi, beforeEach } from "vitest"; | ||
|
||
import { DatabaseClient } from "./database"; | ||
|
||
vi.mock("./client", () => ({ | ||
TursoClient: { request: vi.fn() }, | ||
})); | ||
|
||
describe("DatabaseClient", () => { | ||
let client: DatabaseClient; | ||
|
||
beforeEach(() => { | ||
client = new DatabaseClient({ org: "turso", token: "abc" }); | ||
vi.resetAllMocks(); | ||
}); | ||
|
||
it("should throw an error when both is_schema and schema are provided", async () => { | ||
await expect( | ||
client.create("test", { | ||
is_schema: true, | ||
schema: "test", | ||
} as unknown as (typeof client.create.arguments)[1]) | ||
).rejects.toThrow("'is_schema' and 'schema' cannot both be provided"); | ||
}); | ||
}); |
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