first 2 tests passing

This commit is contained in:
Mateus Badan de Pieri 2023-03-30 17:08:18 +01:00
parent 24fc72657d
commit d03b27f79f
1 changed files with 6 additions and 1 deletions

View File

@ -15,11 +15,16 @@ describe("addTenantToUrl", () => {
it("should append tenantId parameter to the URL query string", () => { it("should append tenantId parameter to the URL query string", () => {
const url = "https://budibase.com?var=test" const url = "https://budibase.com?var=test"
const expectedUrl = "https://budibase.com?var=test&tenantId=default" const expectedUrl = "https://budibase.com?var=test&tenantId=budibase"
expect(addTenantToUrl(url)).toEqual(expectedUrl) expect(addTenantToUrl(url)).toEqual(expectedUrl)
}) })
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
jest.mock("../../src/context", () => ({
isMultiTenant: jest.fn(() => false),
}))
const url = "https://budibase.com" const url = "https://budibase.com"
const expectedUrl = "https://budibase.com" const expectedUrl = "https://budibase.com"
expect(addTenantToUrl(url)).toEqual(expectedUrl) expect(addTenantToUrl(url)).toEqual(expectedUrl)