Skip to content

Commit

Permalink
add mutateClone tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DaBigBlob committed Sep 14, 2024
1 parent 75daaa9 commit d46e9c4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions _tests/test4.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createClient } from "../src/main";
import { createClient, libsqlFetchLike } from "../src/main";
import { skjdgfksg } from "./conf";

(async () => {
const client = createClient({url: skjdgfksg.db_url, authToken: skjdgfksg.authToken});
let client = createClient({url: skjdgfksg.db_url, authToken: skjdgfksg.authToken});

const res = await client.batch([
{
Expand Down Expand Up @@ -33,6 +33,13 @@ import { skjdgfksg } from "./conf";
);
console.log(res3);

client = client.mutateClone({
fetch: async (...args: Parameters<libsqlFetchLike>): ReturnType<libsqlFetchLike> => {
console.log(`[${args[1]?.method} ${args[0]}]: ${args[1]?.body}`);
return await globalThis.fetch(...args);
}
});

const res4 = await client.execute(
"select first_name, last_name, email, contact_id from contacts where contact_id = :aae;",
{aae: 1}
Expand Down

0 comments on commit d46e9c4

Please sign in to comment.