Skip to content

Instantly share code, notes, and snippets.

@dwalleck
Created June 12, 2018 19:44
Show Gist options
  • Save dwalleck/9a69474a5413af9026e526c6838f6be4 to your computer and use it in GitHub Desktop.
Save dwalleck/9a69474a5413af9026e526c6838f6be4 to your computer and use it in GitHub Desktop.
const index = require('../index');
const event = require ('../event.json');
const Compute = require('@google-cloud/compute');
const Bluebird = require('bluebird');
jest.mock('bluebird');
jest.mock('@google-cloud/compute', () => {
return jest.fn().mockImplementation(() => {
return {
getVMsAsync: jest.fn(),
getAddressesAsync: jest.fn(),
getDisksAsync: jest.fn(),
getFirewallsAsync: jest.fn(),
getNetworksAsync: jest.fn(),
getSnapshotsAsync: jest.fn(),
getSubnetworksAsync: jest.fn()
};
});
});
describe('aws-resource-collector', () => {
it('processes a valid event', (done) => {
Bluebird.promisifyAll.mockImplementation((req) => req);
index.handle(event, null, (err, msg) => {
console.log(err, msg);
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment