UNPKG

@buildable/connections

Version:

Buildable is a fully managed event bus lets you send and receive data across mission-critical cloud apps, databases and warehouses.

60 lines 2.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const setEvents_1 = require("../logic/sources/setEvents"); const createSource_1 = require("../logic/sources/createSource"); const logic_1 = require("../logic"); const utils_1 = require("@buildable/utils"); const client_1 = require("../client"); require('dotenv').config(); jest.setTimeout(30000); describe('Connections APIs Specs', () => { it('Should create a Stripe source, subscribe to customer.created event, create a mongodb destination', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const client = (0, client_1.createClient)(process.env.BUILDABLE_SECRET_KEY); const source = yield (0, createSource_1.createSource)(client, { type: 'stripe', group: `my-stripe-source-${(0, utils_1.makeId)(4)}`, label: `my-stripe-source-${(0, utils_1.makeId)(4)}`, config: { STRIPE_SECRET_KEY: process.env.CONNECTIONS_TEST_STRIPE_SECRET_KEY, }, }); expect(source).toHaveProperty('key'); yield new Promise((resolve) => setTimeout(resolve, 5000)); const subscribe = yield (0, setEvents_1.setEvents)(client, { type: 'stripe', key: source.key, events: ['customer.created'], }); expect(subscribe).toHaveProperty('success', true); const destination = yield (0, logic_1.createDestination)(client, { type: 'mongodb', group: `my-mongodb-destination-${(0, utils_1.makeId)(4)}`, label: `my-mongodb-destination-${(0, utils_1.makeId)(4)}`, config: { MONGODB_URI: process.env.CONNECTIONS_TEST_MONGODB_URI, }, }); expect(destination).toHaveProperty('key'); yield new Promise((resolve) => setTimeout(resolve, 5000)); const deleteSourceResult = yield (0, logic_1.deleteSource)(client, { key: source.key, }); expect(deleteSourceResult).toHaveProperty('success', true); const deleteDestinationResult = yield (0, logic_1.deleteDestination)(client, { key: destination.key, }); expect(deleteDestinationResult).toHaveProperty('success', true); })); it('Should list all sources', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const client = (0, client_1.createClient)(process.env.BUILDABLE_SECRET_KEY); const sourceList = yield (0, logic_1.listSources)(client); expect(sourceList).toHaveProperty('rows'); })); it('Should list all destinations', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const client = (0, client_1.createClient)(process.env.BUILDABLE_SECRET_KEY); const destinationList = yield (0, logic_1.listDestinations)(client); expect(destinationList).toHaveProperty('rows'); })); }); //# sourceMappingURL=connections.spec.js.map