Fix datasource.spec.ts's reliance on the node-fetch mock.
This commit is contained in:
parent
a973b65a72
commit
a38dc3d163
|
@ -19,6 +19,7 @@ import {
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { DatabaseName, getDatasource } from "../../../integrations/tests/utils"
|
import { DatabaseName, getDatasource } from "../../../integrations/tests/utils"
|
||||||
import { tableForDatasource } from "../../../tests/utilities/structures"
|
import { tableForDatasource } from "../../../tests/utilities/structures"
|
||||||
|
import nock from "nock"
|
||||||
|
|
||||||
describe("/datasources", () => {
|
describe("/datasources", () => {
|
||||||
const config = setup.getConfig()
|
const config = setup.getConfig()
|
||||||
|
@ -37,6 +38,7 @@ describe("/datasources", () => {
|
||||||
config: {},
|
config: {},
|
||||||
})
|
})
|
||||||
jest.clearAllMocks()
|
jest.clearAllMocks()
|
||||||
|
nock.cleanAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("create", () => {
|
describe("create", () => {
|
||||||
|
@ -71,6 +73,12 @@ describe("/datasources", () => {
|
||||||
|
|
||||||
describe("dynamic variables", () => {
|
describe("dynamic variables", () => {
|
||||||
it("should invalidate changed or removed variables", async () => {
|
it("should invalidate changed or removed variables", async () => {
|
||||||
|
nock("http://www.example.com/")
|
||||||
|
.get("/")
|
||||||
|
.reply(200, [{ value: "test" }])
|
||||||
|
.get("/?test=test")
|
||||||
|
.reply(200, [{ value: 1 }])
|
||||||
|
|
||||||
let datasource = await config.api.datasource.create({
|
let datasource = await config.api.datasource.create({
|
||||||
type: "datasource",
|
type: "datasource",
|
||||||
name: "Rest",
|
name: "Rest",
|
||||||
|
@ -81,7 +89,7 @@ describe("/datasources", () => {
|
||||||
const query = await config.api.query.save({
|
const query = await config.api.query.save({
|
||||||
datasourceId: datasource._id!,
|
datasourceId: datasource._id!,
|
||||||
fields: {
|
fields: {
|
||||||
path: "www.google.com",
|
path: "www.example.com",
|
||||||
},
|
},
|
||||||
parameters: [],
|
parameters: [],
|
||||||
transformer: null,
|
transformer: null,
|
||||||
|
|
Loading…
Reference in New Issue