diff --git a/packages/backend-core/src/db/tests/index.spec.js b/packages/backend-core/src/db/tests/index.spec.js deleted file mode 100644 index e03c9a5b0e..0000000000 --- a/packages/backend-core/src/db/tests/index.spec.js +++ /dev/null @@ -1,24 +0,0 @@ -require("../../../tests") -const { structures } = require("../../../tests") -const { getDB } = require("../db") - -describe("db", () => { - describe("getDB", () => { - it("returns a db", async () => { - const dbName = structures.db.id() - const db = getDB(dbName) - expect(db).toBeDefined() - expect(db.name).toBe(dbName) - }) - - it("uses the custom put function", async () => { - const db = getDB(structures.db.id()) - let doc = { _id: "test" } - await db.put(doc) - doc = await db.get(doc._id) - expect(doc.createdAt).toBe(new Date().toISOString()) - expect(doc.updatedAt).toBe(new Date().toISOString()) - await db.destroy() - }) - }) -}) diff --git a/packages/backend-core/src/db/tests/index.spec.ts b/packages/backend-core/src/db/tests/index.spec.ts new file mode 100644 index 0000000000..d61b0b7655 --- /dev/null +++ b/packages/backend-core/src/db/tests/index.spec.ts @@ -0,0 +1,32 @@ +import { context } from "../.." +import { structures } from "../../../tests" +import { getDB } from "../db" + +interface Doc { + _id: string + createdAt?: string + updatedAt?: string +} + +describe("db", () => { + describe("getDB", () => { + it("returns a db", async () => { + const dbName = structures.db.id() + const db = getDB(dbName) + expect(db).toBeDefined() + expect(db.name).toBe(dbName) + }) + + it("uses the custom put function", async () => { + await context.doInTenant("foo", async () => { + const db = getDB(structures.db.id()) + let doc: Doc = { _id: "test" } + await db.put(doc) + doc = await db.get(doc._id) + expect(doc.createdAt).toBe(new Date().toISOString()) + expect(doc.updatedAt).toBe(new Date().toISOString()) + await db.destroy() + }) + }) + }) +}) diff --git a/packages/backend-core/src/features/tests/features.spec.ts b/packages/backend-core/src/features/tests/features.spec.ts index 1e8e25654a..c8469561c6 100644 --- a/packages/backend-core/src/features/tests/features.spec.ts +++ b/packages/backend-core/src/features/tests/features.spec.ts @@ -147,13 +147,13 @@ describe("feature flags", () => { }) => { const env: Partial = { TENANT_FEATURE_FLAGS: environmentFlags, + SELF_HOSTED: false, } if (posthogFlags) { mockPosthogFlags(posthogFlags) env.POSTHOG_TOKEN = "test" env.POSTHOG_API_HOST = "https://us.i.posthog.com" - env.POSTHOG_PERSONAL_TOKEN = "test" } const ctx = { user: { license: { features: licenseFlags || [] } } }