Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const should = require('should');
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
describe('basic authentication', () => {
// Put your test TEST_USERNAME and TEST_PASSWORD in a .env file.
// The inject method will load them and make them available to use in your
// tests.
zapier.tools.env.inject();
it('should authenticate', (done) => {
const bundle = {
authData: {
username: process.env.TEST_USERNAME,
password: process.env.TEST_PASSWORD
}
};
/* globals describe it */
const should = require('should');
const sinon = require('sinon');
const zapier = require('zapier-platform-core');
const { ProductService } = require('@cloudblueconnect/connect-javascript-sdk/lib/connect/api');
// Use this to make test calls into your app:
const App = require('../../index');
const appTester = zapier.createAppTester(App);
zapier.tools.env.inject();
const responses = require('../responses');
describe('Connect Fulfillment Zapier App - Fulfillment parameters', () => {
let sandbox;
before(() => { sandbox = sinon.createSandbox(); });
afterEach(done => { sandbox.restore(); done(); });
it('should return a list of parameters with scope=asset and phase=fulfillment', done => {
const bundle = {
authData: {
api_key: process.env.CONNECT_API_KEY,
endpoint: process.env.CONNECT_ENDPOINT
},
inputData: {
id: 'PRD-000-000-000'
/**
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
*
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
*/
const should = require('should');
const { Fulfillment } = require('@cloudblueconnect/connect-javascript-sdk');
const sinon = require('sinon');
const zapier = require('zapier-platform-core');
const responses = require('../responses');
// Use this to make test calls into your app:
const App = require('../../index');
const appTester = zapier.createAppTester(App);
zapier.tools.env.inject();
describe('Connect Fulfillment Zapier App - Reject Request', () => {
let sandbox;
before(() => { sandbox = sinon.createSandbox(); });
afterEach(done => { sandbox.restore(); done(); });
it('should return a payload of the rejected request', done => {
const bundle = {
authData: {
api_key: process.env.CONNECT_API_KEY,
endpoint: process.env.CONNECT_ENDPOINT
},
inputData: {
request_id: 'PR-5426-PR-5426-9883-2189-001',
reason: 'Not available'
}
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
*
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
*/
/* globals describe it */
const should = require('should');
const sinon = require('sinon');
const zapier = require('zapier-platform-core');
const { Fulfillment } = require('@cloudblueconnect/connect-javascript-sdk');
const BaseResource = require('@cloudblueconnect/connect-javascript-sdk/lib/connect/api/base');
const { RequestResource } = require('@cloudblueconnect/connect-javascript-sdk/lib/connect/api');
// Use this to make test calls into your app:
const App = require('../../index');
const appTester = zapier.createAppTester(App);
zapier.tools.env.inject();
const responses = require('../responses');
describe('Connect Fulfillment Zapier App - Search Requests', () => {
let sandbox;
before(() => { sandbox = sinon.createSandbox(); });
afterEach(done => { sandbox.restore(); done(); });
it('should return a list of requests filtered by status', done => {
const bundle = {
authData: {
api_key: process.env.CONNECT_API_KEY,
endpoint: process.env.CONNECT_ENDPOINT
},
inputData: {
/**
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
*
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
*/
/* globals describe it */
const should = require('should');
const sinon = require('sinon');
const zapier = require('zapier-platform-core');
const { HubResource } = require('@cloudblueconnect/connect-javascript-sdk/lib/connect/api');
// Use this to make test calls into your app:
const App = require('../../index');
const appTester = zapier.createAppTester(App);
zapier.tools.env.inject();
const responses = require('../responses');
describe('Connect Fulfillment Zapier App - List hubs', () => {
let sandbox;
before(() => { sandbox = sinon.createSandbox(); });
afterEach(done => { sandbox.restore(); done(); });
it('should return a list of hubs', done => {
const bundle = {
authData: {
api_key: process.env.CONNECT_API_KEY,
endpoint: process.env.CONNECT_ENDPOINT
},
inputData: {}
const should = require('should');
const zapier = require('zapier-platform-core');
const App = require('../../index');
const appTester = zapier.createAppTester(App);
describe('contact triggers', () => {
describe('new contact created trigger', () => {
var subscribeData = null;
it('should create a contact create hook', (done) => {
zapier.tools.env.inject();
const bundle = {
targetUrl: 'http://provided.by?zapier',
authData: {
baseUrl: process.env.TEST_BASE_URL,
username: process.env.TEST_BASIC_AUTH_USERNAME,
password: process.env.TEST_BASIC_AUTH_PASSWORD
}
const should = require('should');
const zapier = require('zapier-platform-core');
const App = require('../../index');
const appTester = zapier.createAppTester(App);
describe('form triggers', () => {
describe('new form submission trigger', () => {
var subscribeData = null;
it('should create a form submitted hook', (done) => {
zapier.tools.env.inject();
const bundle = {
targetUrl: 'http://provided.by?zapier',
authData: {
baseUrl: process.env.TEST_BASE_URL,
username: process.env.TEST_BASIC_AUTH_USERNAME,
password: process.env.TEST_BASIC_AUTH_PASSWORD
}
require('should');
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
describe('triggers', () => {
describe('new recipe trigger', () => {
it('should load recipe from fake hook', (done) => {
const bundle = {
inputData: {
style: 'mediterranean'
},
cleanedRequest: {
id: 1,
name: 'name 1',
directions: 'directions 1'
}
};
const should = require('should');
const zapier = require('zapier-platform-core');
const App = require('../../index');
const appTester = zapier.createAppTester(App);
describe('contact triggers', () => {
describe('new contact updated trigger', () => {
var subscribeData = null;
it('should create a contact update hook', (done) => {
zapier.tools.env.inject();
const bundle = {
targetUrl: 'http://provided.by?zapier',
authData: {
baseUrl: process.env.TEST_BASE_URL,
username: process.env.TEST_BASIC_AUTH_USERNAME,
password: process.env.TEST_BASIC_AUTH_PASSWORD
}
const testCreateAppTester = async () => {
const zapierApp = {};
const appTester = await zapier.createAppTester(zapierApp);
};