Skip to content

Instantly share code, notes, and snippets.

@mledom
Last active August 27, 2018 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mledom/aca3191995642d9586fa86f27cd2b107 to your computer and use it in GitHub Desktop.
Save mledom/aca3191995642d9586fa86f27cd2b107 to your computer and use it in GitHub Desktop.
describe('welcomeInstallHandler', () => {
it('sends welcome msg', () => {
const msgMock = jest.fn().mockResolvedValue(null);
SlackClient.mockImplementation(() => {
return {
say: msgMock,
};
});
const event = {
slackWorkspace: {
incoming_webhook: {
channel_id: Math.random(),
},
},
};
const msg = {
attachments: [{
actions: [{
name: 'settings_command',
text: 'Settings',
type: 'button',
value: 'settings',
}],
callback_id: 'welcome_callback',
fallback: 'Checkout out all the latest features with /eletype help!',
text: ':wave: Let\'s get started! First, I need to get some information from you. ' +
'Please click the Settings button below to continue.',
title: 'Welcome!',
}],
channel: event.slackWorkspace.incoming_webhook.channel_id,
text: '',
};
return responder.welcomeInstallHandler(event).then(() => {
expect(msgMock).toBeCalledWith(msg);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment