Fix type tests

This commit is contained in:
Adria Navarro 2023-08-01 12:34:50 +02:00
parent 44e028b574
commit 202963c864
5 changed files with 12 additions and 9 deletions

View File

@ -206,7 +206,7 @@ describe("/api/global/auth", () => {
const newPassword = "newpassword"
const res = await config.api.auth.updatePassword(code!, newPassword)
user = await config.getUser(user.email)
user = (await config.getUser(user.email))!
delete user.password
expect(res.body).toEqual({ message: "password reset successfully." })

View File

@ -36,7 +36,7 @@ describe("/api/global/self", () => {
})
.expect(200)
const dbUser = await config.getUser(user.email)
const dbUser = (await config.getUser(user.email))!
user._rev = dbUser._rev
user.dayPassRecordedAt = mocks.date.MOCK_DATE.toISOString()
@ -58,7 +58,7 @@ describe("/api/global/self", () => {
})
.expect(200)
const dbUser = await config.getUser(user.email)
const dbUser = (await config.getUser(user.email))!
user._rev = dbUser._rev
user.dayPassRecordedAt = mocks.date.MOCK_DATE.toISOString()

View File

@ -66,7 +66,7 @@ describe("/api/global/users", () => {
expect(res.body._id).toBeDefined()
const user = await config.getUser(email)
expect(user).toBeDefined()
expect(user._id).toEqual(res.body._id)
expect(user!._id).toEqual(res.body._id)
expect(events.user.inviteAccepted).toBeCalledTimes(1)
expect(events.user.inviteAccepted).toBeCalledWith(user)
})

View File

@ -1,3 +1,4 @@
import { HealthStatusResponse } from "@budibase/types"
import { TestConfiguration } from "../../../../tests"
import { accounts as _accounts } from "@budibase/backend-core"
const accounts = jest.mocked(_accounts)
@ -31,13 +32,15 @@ describe("/api/system/status", () => {
})
it("returns status in cloud", async () => {
const value = {
health: {
const value: HealthStatusResponse = {
passing: false,
checks: {
login: false,
search: false,
},
}
accounts.getStatus.mockReturnValueOnce(Promise.resolve(value))
accounts.getStatus.mockResolvedValue(value)
const res = await config.api.status.getStatus()

View File

@ -2,7 +2,7 @@ import * as email from "./email"
import { mocks } from "@budibase/backend-core/tests"
import * as _pro from "@budibase/pro"
const pro = jest.mocked(_pro, true)
const pro = jest.mocked(_pro, { shallow: false })
export default {
email,