mirror of
https://github.com/zhigang1992/probot.git
synced 2026-06-17 23:15:30 +08:00
Fix bug introduced in 0.7.3
This commit is contained in:
3
index.js
3
index.js
@@ -35,7 +35,7 @@ module.exports = (options = {}) => {
|
||||
|
||||
// Forward webhooks to robot
|
||||
webhook.on('*', event => {
|
||||
this.log.trace(event, 'webhook received');
|
||||
logger.trace(event, 'webhook received');
|
||||
robot.receive(event);
|
||||
});
|
||||
|
||||
@@ -58,6 +58,7 @@ module.exports = (options = {}) => {
|
||||
return {
|
||||
server,
|
||||
robot,
|
||||
webhook,
|
||||
|
||||
start() {
|
||||
server.listen(options.port);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
const expect = require('expect');
|
||||
const createProbot = require('..');
|
||||
|
||||
describe('Probot', () => {
|
||||
let probot;
|
||||
let event;
|
||||
|
||||
beforeEach(() => {
|
||||
probot = createProbot();
|
||||
// Mock out GitHub App authentication
|
||||
probot.robot.auth = () => Promise.resolve({});
|
||||
|
||||
event = {
|
||||
event: 'push',
|
||||
payload: require('./fixtures/webhook/push')
|
||||
};
|
||||
});
|
||||
|
||||
describe('webhook delivery', () => {
|
||||
it('forwards webhooks to the robot', async () => {
|
||||
probot.robot.receive = expect.createSpy();
|
||||
probot.webhook.emit('*', event);
|
||||
expect(probot.robot.receive).toHaveBeenCalledWith(event);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,7 +113,6 @@ describe('Robot', function () {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('error handling', () => {
|
||||
it('logs errors throw from handlers', async () => {
|
||||
const error = new Error('testing');
|
||||
|
||||
Reference in New Issue
Block a user