From 69873152b6afab9b4ed75111762ad33779c58bf9 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Mon, 19 Dec 2022 15:46:38 +0000 Subject: [PATCH] Add scaffold --- .../TestConfiguration/accounts.ts | 19 +++++++++++++++++++ .../internal-api/TestConfiguration/index.ts | 4 +++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 qa-core/src/config/internal-api/TestConfiguration/accounts.ts diff --git a/qa-core/src/config/internal-api/TestConfiguration/accounts.ts b/qa-core/src/config/internal-api/TestConfiguration/accounts.ts new file mode 100644 index 0000000000..3acad4ebb1 --- /dev/null +++ b/qa-core/src/config/internal-api/TestConfiguration/accounts.ts @@ -0,0 +1,19 @@ +import { Response } from "node-fetch" +import { Table } from "@budibase/types" +import InternalAPIClient from "./InternalAPIClient" +import { responseMessage } from "../fixtures/types/responseMessage" + +export default class AccountsApi { + api: InternalAPIClient + + constructor(apiClient: InternalAPIClient) { + this.api = apiClient + } + + async validateEmail(email: string): Promise<[Response, any]> { + const response = await this.api.post(`/accounts/validate/email`, { body: { email } }) + const json = await response.json() + expect(response).toHaveStatusCode(200) + return [response, json] + } +} diff --git a/qa-core/src/config/internal-api/TestConfiguration/index.ts b/qa-core/src/config/internal-api/TestConfiguration/index.ts index a82c1fdf03..85ce0d9166 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/index.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/index.ts @@ -5,7 +5,7 @@ import TablesApi from "./tables" import RowApi from "./rows" import ScreenApi from "./screens" import UserManagementApi from "./userManagement" - +import AccountsApi from "./accounts" export default class TestConfiguration { applications: ApplicationApi auth: AuthApi @@ -14,6 +14,7 @@ export default class TestConfiguration { tables: TablesApi rows: RowApi users: UserManagementApi + accounts: AccountsApi constructor(apiClient: InternalAPIClient) { this.applications = new ApplicationApi(apiClient) @@ -22,6 +23,7 @@ export default class TestConfiguration { this.auth = new AuthApi(apiClient) this.screen = new ScreenApi(apiClient) this.users = new UserManagementApi(apiClient) + this.accounts = new AccountsApi(apiClient) this.context = {} }