Test fixes
This commit is contained in:
parent
9c169087e6
commit
adbf90887e
|
@ -1,6 +1,9 @@
|
|||
import env from "../src/environment"
|
||||
import { mocks } from "./utilities"
|
||||
|
||||
// must explicitly enable fetch mock
|
||||
mocks.fetch.enable()
|
||||
|
||||
// mock all dates to 2020-01-01T00:00:00.000Z
|
||||
// use tk.reset() to use real dates in individual tests
|
||||
import tk from "timekeeper"
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
const mockFetch = jest.fn()
|
||||
jest.mock("node-fetch", () => mockFetch)
|
||||
|
||||
export default mockFetch
|
||||
const enable = () => {
|
||||
jest.mock("node-fetch", () => mockFetch)
|
||||
}
|
||||
|
||||
export default {
|
||||
...mockFetch,
|
||||
enable,
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { createMockContext } from "@shopify/jest-koa-mocks"
|
||||
import { createMockContext, createMockCookies } from "@shopify/jest-koa-mocks"
|
||||
import { BBContext } from "@budibase/types"
|
||||
|
||||
export const newContext = (): BBContext => {
|
||||
const ctx = createMockContext()
|
||||
return {
|
||||
...ctx,
|
||||
cookies: createMockCookies(),
|
||||
request: {
|
||||
...ctx.request,
|
||||
body: {},
|
||||
|
|
|
@ -45,11 +45,11 @@ const PUBLIC_ENDPOINTS = [
|
|||
method: "POST",
|
||||
},
|
||||
{
|
||||
route: "api/system/environment",
|
||||
route: "/api/system/environment",
|
||||
method: "GET",
|
||||
},
|
||||
{
|
||||
route: "api/system/status",
|
||||
route: "/api/system/status",
|
||||
method: "GET",
|
||||
},
|
||||
// TODO: This should be an internal api
|
||||
|
|
|
@ -14,6 +14,9 @@ env._set("DISABLE_ACCOUNT_PORTAL", false)
|
|||
|
||||
import { mocks } from "@budibase/backend-core/tests"
|
||||
|
||||
// must explicitly enable fetch mock
|
||||
mocks.fetch.enable()
|
||||
|
||||
// mock all dates to 2020-01-01T00:00:00.000Z
|
||||
// use tk.reset() to use real dates in individual tests
|
||||
const tk = require("timekeeper")
|
||||
|
|
Loading…
Reference in New Issue