1
0
Fork 0
mirror of synced 2024-06-02 10:34:40 +12:00
budibase/packages/server/src/integrations/tests/arangodb.spec.ts

39 lines
945 B
TypeScript

import { default as ArangoDBIntegration } from "../arangodb"
jest.mock("arangojs")
class TestConfiguration {
integration: any
constructor(config: any = {}) {
this.integration = new ArangoDBIntegration.integration(config)
}
}
describe("ArangoDB Integration", () => {
let config: any
let indexName = "Users"
beforeEach(() => {
config = new TestConfiguration()
})
it("calls the create method with the correct params", async () => {
const body = {
json: "Hello",
}
const response = await config.integration.create(body)
expect(config.integration.client.query).toHaveBeenCalledWith(
`INSERT Hello INTO collection RETURN NEW`
)
})
it("calls the read method with the correct params", async () => {
const query = {
sql: `test`,
}
const response = await config.integration.read(query)
expect(config.integration.client.query).toHaveBeenCalledWith(query.sql)
})
})