diff --git a/packages/backend-core/tests/core/utilities/structures/db.ts b/packages/backend-core/tests/core/utilities/structures/db.ts index 31a52dce8b..87325573eb 100644 --- a/packages/backend-core/tests/core/utilities/structures/db.ts +++ b/packages/backend-core/tests/core/utilities/structures/db.ts @@ -1,4 +1,4 @@ -import { structures } from ".." +import { generator } from "./generator" import { newid } from "../../../../src/docIds/newid" export function id() { @@ -6,7 +6,7 @@ export function id() { } export function rev() { - return `${structures.generator.character({ + return `${generator.character({ numeric: true, - })}-${structures.uuid().replace(/-/, "")}` + })}-${generator.guid().replace(/-/, "")}` } diff --git a/packages/backend-core/tests/core/utilities/structures/documents/index.ts b/packages/backend-core/tests/core/utilities/structures/documents/index.ts new file mode 100644 index 0000000000..1c82c5b7d4 --- /dev/null +++ b/packages/backend-core/tests/core/utilities/structures/documents/index.ts @@ -0,0 +1 @@ +export * from "./platform" \ No newline at end of file diff --git a/packages/backend-core/tests/core/utilities/structures/documents/platform/index.ts b/packages/backend-core/tests/core/utilities/structures/documents/platform/index.ts new file mode 100644 index 0000000000..46b85f0435 --- /dev/null +++ b/packages/backend-core/tests/core/utilities/structures/documents/platform/index.ts @@ -0,0 +1 @@ +export * as installation from "./installation" \ No newline at end of file diff --git a/packages/backend-core/tests/core/utilities/structures/installation.ts b/packages/backend-core/tests/core/utilities/structures/documents/platform/installation.ts similarity index 82% rename from packages/backend-core/tests/core/utilities/structures/installation.ts rename to packages/backend-core/tests/core/utilities/structures/documents/platform/installation.ts index bd2ae4abfe..30d58fd349 100644 --- a/packages/backend-core/tests/core/utilities/structures/installation.ts +++ b/packages/backend-core/tests/core/utilities/structures/documents/platform/installation.ts @@ -1,9 +1,11 @@ import { generator } from "@budibase/backend-core/tests" import { Installation } from "@budibase/types" +import * as db from "../../db" export function install(): Installation { return { _id: "install", + _rev: db.rev(), installId: generator.guid(), version: generator.string() } diff --git a/packages/backend-core/tests/core/utilities/structures/index.ts b/packages/backend-core/tests/core/utilities/structures/index.ts index c4404856e1..1a49e912fc 100644 --- a/packages/backend-core/tests/core/utilities/structures/index.ts +++ b/packages/backend-core/tests/core/utilities/structures/index.ts @@ -2,7 +2,7 @@ export * from "./common" export * as accounts from "./accounts" export * as apps from "./apps" export * as db from "./db" -export * as installation from "./installation" +export * as docs from "./documents" export * as koa from "./koa" export * as licenses from "./licenses" export * as plugins from "./plugins" diff --git a/packages/backend-core/tests/core/utilities/structures/licenses.ts b/packages/backend-core/tests/core/utilities/structures/licenses.ts index 35c9156ec6..fae0c7d807 100644 --- a/packages/backend-core/tests/core/utilities/structures/licenses.ts +++ b/packages/backend-core/tests/core/utilities/structures/licenses.ts @@ -2,7 +2,9 @@ import { Billing, Customer, Feature, - License, OfflineLicense, + License, + OfflineIdentifier, + OfflineLicense, PlanModel, PlanType, PriceDuration, @@ -154,9 +156,16 @@ export function offlineLicense ( return { ...base, expireAt: new Date().toISOString(), - identifier: { - installId: generator.guid(), - tenantId: generator.guid() - } + identifier: offlineIdentifier() + } +} + +export function offlineIdentifier( + installId: string = generator.guid(), + tenantId: string = generator.guid(), +): OfflineIdentifier { + return { + installId, + tenantId } } \ No newline at end of file