airtable tests
This commit is contained in:
parent
31c0905ade
commit
c31e04eb73
|
@ -0,0 +1,15 @@
|
|||
class Airtable {
|
||||
constructor() {}
|
||||
|
||||
base() {
|
||||
return () => ({
|
||||
query: jest.fn(),
|
||||
create: jest.fn(),
|
||||
select: jest.fn(),
|
||||
update: jest.fn(),
|
||||
destroy: jest.fn(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Airtable
|
|
@ -66,6 +66,7 @@ class AirtableIntegration {
|
|||
constructor(config) {
|
||||
this.config = config
|
||||
this.client = new Airtable(config).base(config.base)
|
||||
console.log(new Airtable().base())
|
||||
}
|
||||
|
||||
async create(query) {
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
const Airtable = require("airtable")
|
||||
const { ElectronHttpExecutor } = require("electron-updater/out/electronHttpExecutor")
|
||||
const { integration } = require("../airtable")
|
||||
|
||||
jest.mock("airtable")
|
||||
|
||||
class TestConfiguration {
|
||||
constructor(config = {}) {
|
||||
this.integration = new integration(config)
|
||||
}
|
||||
}
|
||||
|
||||
describe("Airtable Integration", () => {
|
||||
let config
|
||||
|
||||
beforeEach(() => {
|
||||
config = new TestConfiguration()
|
||||
})
|
||||
|
||||
it("calls the create method with the correct params", async () => {
|
||||
const response = await config.integration.create({
|
||||
table: "test",
|
||||
json: ""
|
||||
})
|
||||
expect(Airtable.create).toHaveBeenCalledWith({})
|
||||
})
|
||||
|
||||
it("calls the read method with the correct params", () => {
|
||||
|
||||
})
|
||||
|
||||
it("calls the update method with the correct params", () => {
|
||||
|
||||
})
|
||||
|
||||
it("calls the delete method with the correct params", () => {
|
||||
|
||||
})
|
||||
})
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
const Airtable = require("airtable")
|
||||
const { ElectronHttpExecutor } = require("electron-updater/out/electronHttpExecutor")
|
||||
const AirtableIntegration = require("../airtable")
|
||||
jest.mock("airtable")
|
||||
|
||||
class TestConfiguration {
|
||||
constructor(config = {}) {
|
||||
this.integration = new AirtableIntegration.integration(config)
|
||||
}
|
||||
}
|
||||
|
||||
describe("Airtable Integration", () => {
|
||||
let config
|
||||
|
||||
beforeEach(() => {
|
||||
config = new TestConfiguration()
|
||||
})
|
||||
|
||||
it("calls the create method with the correct params", async () => {
|
||||
const response = await config.integration.create({
|
||||
table: "test",
|
||||
json: ""
|
||||
})
|
||||
expect(config.integration.client.create).toHaveBeenCalledWith({})
|
||||
})
|
||||
|
||||
it("calls the read method with the correct params", () => {
|
||||
|
||||
})
|
||||
|
||||
it("calls the update method with the correct params", () => {
|
||||
|
||||
})
|
||||
|
||||
it("calls the delete method with the correct params", () => {
|
||||
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue