Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timokoessler committed Dec 13, 2024
1 parent 2f35bee commit 0ac3238
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion library/helpers/getPackageVersion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { getPackageVersion } from "./getPackageVersion";
t.test("it resolves the version of a package", async (t) => {
t.same(getPackageVersion("express"), "5.0.1");
t.same(getPackageVersion("non-existing-package"), null);
t.same(getPackageVersion("@google-cloud/functions-framework"), "3.4.2");
t.same(getPackageVersion("@google-cloud/functions-framework"), "3.4.3");
});
18 changes: 3 additions & 15 deletions library/sinks/Prisma.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,13 @@ t.test("it works with sqlite", testOpts, async (t) => {
process.env.DATABASE_URL = "file:./dev.db";

// Generate prismajs client
const { stdout, stderr } = await execAsync(
await execAsync(
"npx prisma migrate reset --force", // Generate prisma client, reset db and apply migrations
{
cwd: path.join(__dirname, "fixtures/prisma/sqlite"),
}
);

if (stderr) {
t.fail(stderr);
}

const { PrismaClient } = require("@prisma/client");

const client = new PrismaClient();
Expand Down Expand Up @@ -154,17 +150,13 @@ t.test("it works with postgres", testOpts, async (t) => {
process.env.DATABASE_URL = "postgres://root:[email protected]:27016/main_db";

// Generate prismajs client
const { stdout, stderr } = await execAsync(
await execAsync(
"npx prisma migrate reset --force", // Generate prisma client, reset db and apply migrations
{
cwd: path.join(__dirname, "fixtures/prisma/postgres"),
}
);

if (stderr) {
t.fail(stderr);
}

// Clear require cache
for (const key in require.cache) {
delete require.cache[key];
Expand Down Expand Up @@ -254,17 +246,13 @@ t.test("it works with mongodb", testOpts, async (t) => {
"mongodb://root:[email protected]:27020/prisma?authSource=admin&directConnection=true";

// Generate prismajs client
const { stdout, stderr } = await execAsync(
await execAsync(
"npx prisma generate", // Generate prisma client, reset db and apply migrations
{
cwd: path.join(__dirname, "fixtures/prisma/mongodb"),
}
);

if (stderr) {
t.fail(stderr);
}

// Clear require cache
for (const key in require.cache) {
delete require.cache[key];
Expand Down

0 comments on commit 0ac3238

Please sign in to comment.