mirror of https://github.com/Budibase/budibase.git
5 changed files with 94 additions and 0 deletions
@ -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 |
|||
@ -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