From 7f8e093a52727ff8273335bf2131ee094441e7b1 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Mon, 28 Nov 2022 22:13:07 +0000 Subject: [PATCH] Add verification --- .../TestConfiguration/userManagement.ts | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts b/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts index 3a66049fd0..2ff9450939 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts @@ -1,5 +1,5 @@ import { Response } from "node-fetch" -import { User } from "@budibase/types" +import { User, UserDeletedEvent } from "@budibase/types" import InternalAPIClient from "./InternalAPIClient" import { responseMessage } from "../fixtures/types/responseMessage" @@ -14,7 +14,8 @@ export default class UserManagementApi { const response = await this.api.post(`/global/users/search`, {}) const json = await response.json() expect(response).toHaveStatusCode(200) - expect(json.length).toBeGreaterThan(0) + expect(json.data.length).toBeGreaterThan(0) + expect(json.hasNextPage).toBe(false) return [response, json] } @@ -40,4 +41,21 @@ export default class UserManagementApi { expect(json.unsuccessful.length).toEqual(0) return [response, json] } + + async deleteUser(userId: string): Promise<[Response, responseMessage]> { + const body = { + delete: { + userIds: [ + userId + ] + } + } + const response = await this.api.post(`/global/users/bulk`, { body }) + const json = await response.json() + expect(response).toHaveStatusCode(200) + expect(json.deleted.successful.length).toEqual(1) + expect(json.deleted.unsuccessful.length).toEqual(0) + expect(json.deleted.successful[0].userId).toEqual(userId) + return [response, json] + } }