first tenancy tests working
This commit is contained in:
parent
b19df9da22
commit
6404f07cfe
|
@ -44,7 +44,7 @@ export function baseGlobalDBName(tenantId: string | undefined | null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isMultiTenant() {
|
export function isMultiTenant() {
|
||||||
return env.MULTI_TENANCY
|
return !!env.MULTI_TENANCY
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isTenantIdSet() {
|
export function isTenantIdSet() {
|
||||||
|
|
|
@ -5,7 +5,10 @@ jest.mock("../../context", () => ({
|
||||||
}))
|
}))
|
||||||
|
|
||||||
import { addTenantToUrl } from "../"
|
import { addTenantToUrl } from "../"
|
||||||
|
import { isMultiTenant } from "../../context"
|
||||||
|
const mockedIsMultiTenant = isMultiTenant as jest.MockedFunction<
|
||||||
|
typeof isMultiTenant
|
||||||
|
>
|
||||||
describe("addTenantToUrl", () => {
|
describe("addTenantToUrl", () => {
|
||||||
it("should append tenantId parameter to the URL", () => {
|
it("should append tenantId parameter to the URL", () => {
|
||||||
const url = "https://budibase.com"
|
const url = "https://budibase.com"
|
||||||
|
@ -21,9 +24,8 @@ describe("addTenantToUrl", () => {
|
||||||
|
|
||||||
it("should not append tenantId parameter to the URL if isMultiTenant is false", () => {
|
it("should not append tenantId parameter to the URL if isMultiTenant is false", () => {
|
||||||
// mock the `isMultiTenant` function to return 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 url = "https://budibase.com"
|
||||||
const expectedUrl = "https://budibase.com"
|
const expectedUrl = "https://budibase.com"
|
||||||
|
|
Loading…
Reference in New Issue