1
0
Fork 0
mirror of synced 2024-10-06 04:54:52 +13:00

first tenancy tests working

This commit is contained in:
Mateus Badan de Pieri 2023-03-30 17:27:13 +01:00
parent b19df9da22
commit 6404f07cfe
2 changed files with 7 additions and 5 deletions

View file

@ -44,7 +44,7 @@ export function baseGlobalDBName(tenantId: string | undefined | null) {
}
export function isMultiTenant() {
return env.MULTI_TENANCY
return !!env.MULTI_TENANCY
}
export function isTenantIdSet() {

View file

@ -5,7 +5,10 @@ jest.mock("../../context", () => ({
}))
import { addTenantToUrl } from "../"
import { isMultiTenant } from "../../context"
const mockedIsMultiTenant = isMultiTenant as jest.MockedFunction<
typeof isMultiTenant
>
describe("addTenantToUrl", () => {
it("should append tenantId parameter to the URL", () => {
const url = "https://budibase.com"
@ -21,9 +24,8 @@ describe("addTenantToUrl", () => {
it("should not append tenantId parameter to the URL if isMultiTenant is false", () => {
// mock the `isMultiTenant` function to return false
jest.mock("../../src/context", () => ({
isMultiTenant: jest.fn(() => false),
}))
mockedIsMultiTenant.mockImplementation(() => false)
const url = "https://budibase.com"
const expectedUrl = "https://budibase.com"