@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 27 lines 957 Bytes
Raw
1 import { assert, it } from "@effect/vitest"
2 import { Effect, Fiber } from "effect"
3 import * as SqlClient from "effect/sql/SqlClient"
4 import { MssqlContainer } from "./utils.ts"
5
6 // One connection, so the statement after the interruption runs on the
7 // connection whose request was cancelled.
8 it.layer(MssqlContainer.layerClientWith({ maxConnections: 1 }), {
9 timeout: "120 seconds",
10 excludeTestServices: true
11 })("MssqlClient (integration)", (it) => {
12 it.effect(
13 "runs the next statement on a connection whose running statement was interrupted",
14 () =>
15 Effect.gen(function*() {
16 const sql = yield* SqlClient.SqlClient
17 const running = yield* Effect.forkChild(sql`WAITFOR DELAY '00:00:05'`)
18 yield* Effect.sleep("200 millis")
19 yield* Fiber.interrupt(running)
20
21 const rows = yield* sql<{ n: number }>`SELECT 1 AS n`
22
23 assert.deepStrictEqual(rows, [{ n: 1 }])
24 }),
25 { timeout: 30_000 }
26 )
27 })