fix tests
This commit is contained in:
parent
eed3bdcb6b
commit
22bbbb5ba4
|
@ -75,6 +75,7 @@ exports.update = async function (ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.save = async function (ctx) {
|
exports.save = async function (ctx) {
|
||||||
|
console.log(ctx.request.body)
|
||||||
const db = new CouchDB(ctx.appId)
|
const db = new CouchDB(ctx.appId)
|
||||||
const plus = ctx.request.body.datasource.plus
|
const plus = ctx.request.body.datasource.plus
|
||||||
const fetchSchema = ctx.request.body.fetchSchema
|
const fetchSchema = ctx.request.body.fetchSchema
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// mock out postgres for this
|
// mock out postgres for this
|
||||||
jest.mock("pg")
|
jest.mock("pg")
|
||||||
|
|
||||||
|
const { findLastKey } = require("lodash/fp")
|
||||||
const setup = require("./utilities")
|
const setup = require("./utilities")
|
||||||
const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
|
const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
|
||||||
const { basicQuery, basicDatasource } = setup.structures
|
const { basicQuery, basicDatasource } = setup.structures
|
||||||
|
@ -19,10 +20,10 @@ describe("/queries", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
async function createInvalidIntegration() {
|
async function createInvalidIntegration() {
|
||||||
const datasource = await config.createDatasource({
|
const datasource = await config.createDatasource({datasource: {
|
||||||
...basicDatasource(),
|
...basicDatasource().datasource,
|
||||||
source: "INVALID_INTEGRATION",
|
source: "INVALID_INTEGRATION",
|
||||||
})
|
}})
|
||||||
const query = await config.createQuery()
|
const query = await config.createQuery()
|
||||||
return { datasource, query }
|
return { datasource, query }
|
||||||
}
|
}
|
||||||
|
@ -183,11 +184,14 @@ describe("/queries", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should fail with invalid integration type", async () => {
|
it("should fail with invalid integration type", async () => {
|
||||||
const { query } = await createInvalidIntegration()
|
const { query, datasource } = await createInvalidIntegration()
|
||||||
await request
|
await request
|
||||||
.post(`/api/queries/${query._id}`)
|
.post(`/api/queries/${query._id}`)
|
||||||
.send({
|
.send({
|
||||||
|
datasourceId: datasource._id,
|
||||||
parameters: {},
|
parameters: {},
|
||||||
|
fields: {},
|
||||||
|
queryVerb: "read",
|
||||||
})
|
})
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
.expect(400)
|
.expect(400)
|
||||||
|
|
|
@ -70,10 +70,12 @@ exports.basicRole = () => {
|
||||||
|
|
||||||
exports.basicDatasource = () => {
|
exports.basicDatasource = () => {
|
||||||
return {
|
return {
|
||||||
|
datasource: {
|
||||||
type: "datasource",
|
type: "datasource",
|
||||||
name: "Test",
|
name: "Test",
|
||||||
source: "POSTGRES",
|
source: "POSTGRES",
|
||||||
config: {},
|
config: {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue