Last active
August 27, 2018 15:26
-
-
Save mledom/aca3191995642d9586fa86f27cd2b107 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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