From db0a5d237ced3f5d0311a6cc7923adca5fa21b57 Mon Sep 17 00:00:00 2001 From: Karol Czeryna Date: Sun, 9 Feb 2025 17:08:21 +0100 Subject: [PATCH] chore: generate files during tests in CI --- .github/workflows/ci.yml | 8 +++----- test/cases/aggregate.test.ts | 7 ++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 586a8b1..8ed50b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,13 +28,11 @@ jobs: sqlc-version: '1.27.0' - uses: oven-sh/setup-bun@v2 - run: wget https://github.com/bytecodealliance/javy/releases/download/v4.0.0/javy-x86_64-linux-v4.0.0.gz - - run: gzip -d javy-x86_64-linux-v4.0.0.gz - - run: chmod +x javy-x86_64-linux-v4.0.0 + - run: gzip -d javy-x86_64-linux-v4.0.0.gz -c > ./javy + - run: chmod +x ./javy - run: bun install - - run: bun build --entrypoints ./src/app.ts --outfile=out.js --minify --target browser - - run: ./javy-x86_64-linux-v4.0.0 build out.js -o plugin.wasm - name: Run tests - run: cd test && bun run test + run: bun run test - id: calculate_sha256 run: | sha256sum plugin.wasm > plugin.wasm.sha256 diff --git a/test/cases/aggregate.test.ts b/test/cases/aggregate.test.ts index d22cb99..9a61560 100644 --- a/test/cases/aggregate.test.ts +++ b/test/cases/aggregate.test.ts @@ -1,7 +1,5 @@ import { expect, it, describe } from "bun:test"; -import { db, prepare, sql } from "../case"; -import { aggEmails } from "./aggregate_sql"; - +import { db, gen, prepare, sql } from "../case"; await prepare(sql` -- name: AggEmails :one SELECT array_agg(e.id::text)::text[] AS emails FROM emails e; @@ -9,8 +7,7 @@ await prepare(sql` describe("aggregation", () => { it("returns an array type", async () => { - // this should not have any LSP error - const result = (await aggEmails(db)) as string[]; + const result = await gen().aggEmails(db); expect(result).toHaveLength(3); expect(Array.isArray(result)).toBe(true);