Updating comments

This commit is contained in:
Mitch-Budibase 2023-07-19 15:18:02 +01:00
parent e7d304d4cf
commit b01c800d08
2 changed files with 15 additions and 14 deletions

View File

@ -13,7 +13,7 @@ describe("Account Internal Operations", () => {
await config.afterAll() await config.afterAll()
}) })
it("performs account deletion", async () => { it("performs account deletion by ID", async () => {
// Deleting by unknown id doesn't work // Deleting by unknown id doesn't work
const accountId = generator.string() const accountId = generator.string()
await config.api.accounts.delete(accountId, { status: 404 }) await config.api.accounts.delete(accountId, { status: 404 })

View File

@ -2,7 +2,7 @@ import TestConfiguration from "../../config/TestConfiguration"
import * as fixtures from "../../fixtures" import * as fixtures from "../../fixtures"
import { generator } from "../../../shared" import { generator } from "../../../shared"
describe("accounts", () => { describe("Accounts", () => {
const config = new TestConfiguration() const config = new TestConfiguration()
beforeAll(async () => { beforeAll(async () => {
@ -15,18 +15,19 @@ describe("accounts", () => {
it("performs signup and deletion flow", async () => { it("performs signup and deletion flow", async () => {
await config.doInNewState(async () => { await config.doInNewState(async () => {
// Create account
const createAccountRequest = fixtures.accounts.generateAccount() const createAccountRequest = fixtures.accounts.generateAccount()
const email = createAccountRequest.email const email = createAccountRequest.email
const tenantId = createAccountRequest.tenantId const tenantId = createAccountRequest.tenantId
// Validation - email and tenant id allowed // Validation - email and tenant ID allowed
await config.api.accounts.validateEmail(email) await config.api.accounts.validateEmail(email)
await config.api.accounts.validateTenantId(tenantId) await config.api.accounts.validateTenantId(tenantId)
// Create unverified account // Create unverified account
await config.api.accounts.create(createAccountRequest) await config.api.accounts.create(createAccountRequest)
// Validation - email and tenant id no longer valid // Validation - email and tenant ID no longer valid
await config.api.accounts.validateEmail(email, { status: 400 }) await config.api.accounts.validateEmail(email, { status: 400 })
await config.api.accounts.validateTenantId(tenantId, { status: 400 }) await config.api.accounts.validateTenantId(tenantId, { status: 400 })
@ -50,15 +51,15 @@ describe("accounts", () => {
}) })
}) })
describe("searching accounts", () => { describe("Searching accounts", () => {
it("searches by tenant id", async () => { it("search by tenant ID", async () => {
const tenantId = generator.string() const tenantId = generator.string()
// empty result // Empty result
const [emptyRes, emptyBody] = await config.api.accounts.search(tenantId, "tenantId") const [_, emptyBody] = await config.api.accounts.search(tenantId, "tenantId")
expect(emptyBody.length).toBe(0) expect(emptyBody.length).toBe(0)
// hit result // Hit result
const [hitRes, hitBody] = await config.api.accounts.search(config.state.tenantId!, "tenantId") const [hitRes, hitBody] = await config.api.accounts.search(config.state.tenantId!, "tenantId")
expect(hitBody.length).toBe(1) expect(hitBody.length).toBe(1)
expect(hitBody[0].tenantId).toBe(config.state.tenantId) expect(hitBody[0].tenantId).toBe(config.state.tenantId)
@ -67,11 +68,11 @@ describe("accounts", () => {
it("searches by email", async () => { it("searches by email", async () => {
const email = generator.email() const email = generator.email()
// empty result // Empty result
const [emptyRes, emptyBody] = await config.api.accounts.search(email, "email") const [_, emptyBody] = await config.api.accounts.search(email, "email")
expect(emptyBody.length).toBe(0) expect(emptyBody.length).toBe(0)
// hit result // Hit result
const [hitRes, hitBody] = await config.api.accounts.search(config.state.email!, "email") const [hitRes, hitBody] = await config.api.accounts.search(config.state.email!, "email")
expect(hitBody.length).toBe(1) expect(hitBody.length).toBe(1)
expect(hitBody[0].email).toBe(config.state.email) expect(hitBody[0].email).toBe(config.state.email)