diff --git a/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts b/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts index 52f610ab17..4a6dbfd1e1 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts @@ -10,7 +10,7 @@ export default class UserManagementApi { this.api = apiClient } - async searchUsers(): Promise<[Response, User[]]> { + async searchUsers(): Promise<[Response, Partial[]]> { const response = await this.api.post(`/global/users/search`, {}) const json = await response.json() expect(response).toHaveStatusCode(200) @@ -18,14 +18,14 @@ export default class UserManagementApi { return [response, json] } - async getSelf(): Promise<[Response, User]> { + async getSelf(): Promise<[Response, Partial]> { const response = await this.api.get(`/global/self`) const json = await response.json() expect(response).toHaveStatusCode(200) return [response, json] } - async getAllUsers(): Promise<[Response, User[]]> { + async getAllUsers(): Promise<[Response, Partial[]]> { const response = await this.api.get(`/global/users`) const json = await response.json() expect(response).toHaveStatusCode(200) @@ -33,7 +33,7 @@ export default class UserManagementApi { return [response, json] } - async addMultipleUsers(userList: User[]): Promise<[Response, any]> { + async addMultipleUsers(userList: Partial[]): Promise<[Response, any]> { const body = { create: { users: userList, diff --git a/qa-core/src/config/internal-api/fixtures/userManagement.ts b/qa-core/src/config/internal-api/fixtures/userManagement.ts index 78374ae6e1..077f42ae57 100644 --- a/qa-core/src/config/internal-api/fixtures/userManagement.ts +++ b/qa-core/src/config/internal-api/fixtures/userManagement.ts @@ -3,7 +3,7 @@ import { User } from "@budibase/types"; import { generateUserMetadataID } from "@budibase/backend-core/src/db"; -const generateDeveloper = (): User => { +const generateDeveloper = (): Partial => { const randomId = generator.guid(); return ({ email: `pedro+${randomId}@budibase.com`, @@ -16,7 +16,7 @@ const generateDeveloper = (): User => { }) } -const generateAdmin = (): User => { +const generateAdmin = (): Partial => { const randomId = generator.guid(); return ({ email: `pedro+${randomId}@budibase.com`, @@ -31,7 +31,7 @@ const generateAdmin = (): User => { } }) } -const generateAppUser = (): User => { +const generateAppUser = (): Partial => { const randomId = generator.guid(); return ({ email: `pedro+${randomId}@budibase.com`, @@ -59,8 +59,8 @@ export const generateInviteUser = (): Object[] => { } -export const generateUser = (amount: number = 1, role?: string): User[] => { - const userList: User[] = []; +export const generateUser = (amount: number = 1, role?: string): Partial[] => { + const userList: Partial[] = []; for (let i = 0; i < amount; i++) { switch (role) { case "admin": diff --git a/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts b/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts index cd8d9cbf65..78cb6deca0 100644 --- a/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts +++ b/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts @@ -135,7 +135,7 @@ describe("Internal API - User Management & Permissions", () => { }) it("Add POWER user to app", async () => { - const powerUser = generateUser(1, 'Developer') + const powerUser = generateUser(1, 'developer') expect(powerUser[0].builder?.global).toEqual(true) const [createUserResponse, createUserJson] = await config.users.addMultipleUsers(powerUser) @@ -153,8 +153,8 @@ describe("Internal API - User Management & Permissions", () => { await config.users.changeUserInformation(body) const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getUserInformation(createUserJson.created.successful[0]._id) - expect(changedUserInfoJson.roles[app.appId?.toString() || ""]).toBeDefined() - expect(changedUserInfoJson.roles[app.appId?.toString() || ""]).toEqual("POWER") + expect(changedUserInfoJson.roles[app.appId]).toBeDefined() + expect(changedUserInfoJson.roles[app.appId]).toEqual("POWER") })