Dry
This commit is contained in:
parent
9936d03e27
commit
5d58fc5948
|
@ -14,7 +14,7 @@ describe("utils", () => {
|
|||
})
|
||||
|
||||
it("should call platform logout", async () => {
|
||||
await doInTenant(`tenant-${newid()}`, async () => {
|
||||
await doInTenant(structures.tenant.name(), async () => {
|
||||
const ctx = structures.koa.newContext()
|
||||
await utils.platformLogout({ ctx, userId: "test" })
|
||||
expect(events.auth.logout).toBeCalledTimes(1)
|
||||
|
|
|
@ -8,3 +8,4 @@ export * as apps from "./apps"
|
|||
export * as koa from "./koa"
|
||||
export * as licenses from "./licenses"
|
||||
export * as plugins from "./plugins"
|
||||
export * as tenant from "./tenants"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { newid } from "../../../src/newid"
|
||||
|
||||
export function name() {
|
||||
return `tenant-${newid()}`
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import { generator, mocks } from "@budibase/backend-core/tests"
|
||||
import { generator, mocks, structures } from "@budibase/backend-core/tests"
|
||||
|
||||
// init the licensing mock
|
||||
import * as pro from "@budibase/pro"
|
||||
|
@ -149,7 +149,7 @@ class TestConfiguration {
|
|||
async init(appName = newid()) {
|
||||
this.defaultUserValues = this.populateDefaultUserValues()
|
||||
if (context.isMultiTenant()) {
|
||||
this.tenantId = `tenant-${newid()}`
|
||||
this.tenantId = structures.tenant.name()
|
||||
}
|
||||
|
||||
if (!this.started) {
|
||||
|
|
|
@ -20,7 +20,6 @@ import {
|
|||
auth,
|
||||
constants,
|
||||
env as coreEnv,
|
||||
utils,
|
||||
DEFAULT_TENANT_ID,
|
||||
} from "@budibase/backend-core"
|
||||
import structures, { TENANT_ID, CSRF_TOKEN } from "./structures"
|
||||
|
@ -136,7 +135,7 @@ class TestConfiguration {
|
|||
|
||||
async beforeAll() {
|
||||
try {
|
||||
this.#tenantId = `tenant-${utils.newid()}`
|
||||
this.#tenantId = structures.tenant.name()
|
||||
|
||||
// Running tests in parallel causes issues creating the globaldb twice. This ensures the db is properly created before starting
|
||||
await retry(async () => await this.createDefaultUser())
|
||||
|
|
|
@ -100,7 +100,7 @@ export class UserAPI extends TestAPI {
|
|||
request = {
|
||||
email: structures.email(),
|
||||
password: generator.string(),
|
||||
tenantId: `tenant-${structures.uuid()}`,
|
||||
tenantId: structures.tenant.name(),
|
||||
}
|
||||
}
|
||||
const res = await this.request
|
||||
|
|
Loading…
Reference in New Issue