| 1 | import { assert, it } from "@effect/vitest"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Layer from "effect/Layer"; |
| 4 | import * as SqlClient from "effect/sql/SqlClient"; |
| 5 | |
| 6 | import { runMigrations } from "../Migrations.ts"; |
| 7 | import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient"; |
| 8 | |
| 9 | const layer = it.layer(Layer.mergeAll(NodeSqliteClient.layer({ filename: ":memory:" }))); |
| 10 | |
| 11 | layer("040_ProjectionProjectFaviconPath", (it) => { |
| 12 | it.effect("adds the nullable favicon path to project projections", () => |
| 13 | Effect.gen(function* () { |
| 14 | const sql = yield* SqlClient.SqlClient; |
| 15 | |
| 16 | yield* runMigrations({ toMigrationInclusive: 39 }); |
| 17 | yield* runMigrations({ toMigrationInclusive: 40 }); |
| 18 | |
| 19 | const columns = yield* sql<{ readonly name: string; readonly notnull: number }>` |
| 20 | PRAGMA table_info(projection_projects) |
| 21 | `; |
| 22 | const faviconPath = columns.find((column) => column.name === "favicon_path"); |
| 23 | |
| 24 | assert.equal(faviconPath?.name, "favicon_path"); |
| 25 | assert.equal(faviconPath?.notnull, 0); |
| 26 | }), |
| 27 | ); |
| 28 | }); |