Skip to content

Commit

Permalink
Merge pull request #11348 from Budibase/fix-master-ci
Browse files Browse the repository at this point in the history
Fix issues with tests when running with pro from npm
  • Loading branch information
Rory-Powell authored Jul 25, 2023
2 parents f08c70e + 1d761b2 commit b72e2eb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 4 additions & 0 deletions packages/worker/__mocks__/@budibase/pro.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const actual = jest.requireActual("@budibase/pro")
const pro = {
...actual,
features: {
...actual.features,
isSSOEnforced: jest.fn(),
},
licensing: {
keys: {
activateLicenseKey: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ describe("configs", () => {
describe("GET /api/global/configs/public", () => {
it("should return the expected public settings", async () => {
await saveSettingsConfig()
mocks.pro.features.isSSOEnforced.mockResolvedValue(false)

const res = await config.api.configs.getPublicSettings()
const body = res.body as GetPublicSettingsResponse
Expand Down
9 changes: 2 additions & 7 deletions packages/worker/src/sdk/users/tests/users.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { structures } from "../../../tests"
import { mocks } from "@budibase/backend-core/tests"
import { structures, mocks } from "../../../tests"
import { env, context } from "@budibase/backend-core"
import * as users from "../users"
import { CloudAccount } from "@budibase/types"
import { isPreventPasswordActions } from "../users"

jest.mock("@budibase/pro")
import * as _pro from "@budibase/pro"
const pro = jest.mocked(_pro, true)

describe("users", () => {
beforeEach(() => {
jest.clearAllMocks()
Expand Down Expand Up @@ -56,7 +51,7 @@ describe("users", () => {
it("returns true for all users when sso is enforced", async () => {
await context.doInTenant(structures.tenant.id(), async () => {
const user = structures.users.user()
pro.features.isSSOEnforced.mockResolvedValueOnce(true)
mocks.pro.features.isSSOEnforced.mockResolvedValueOnce(true)
const result = await users.isPreventPasswordActions(user)
expect(result).toBe(true)
})
Expand Down

0 comments on commit b72e2eb

Please sign in to comment.