Last active
June 8, 2020 05:41
-
-
Save dschinkel/0293e408cba6cf15ca69160fad4c2ef7 to your computer and use it in GitHub Desktop.
Example Spec
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
it('only sends one welcome message', async () => { | |
mockPost('/chat.postMessage', { called: true }); | |
const channel = ''; | |
const user: SlackUser = { | |
token: '', | |
trigger_id: '', | |
view: undefined, | |
id: '', | |
team_id: '' | |
}; | |
const addedCrafter = { | |
rows: [ | |
{ | |
crafter_email: '', | |
crafter_name_first: '', | |
crafter_name_last: '', | |
crafter_slack_received_welcome_msg: false, | |
crafter_slack_user_id: user.id | |
} | |
] | |
} | |
fakeDB.client = createClient(addedCrafter) | |
fakeDatabase(fakeDB.client); | |
let response = await sendWelcomeDMMessage(channel, user); | |
expect(response.body.called).toBe(true); | |
addedCrafter.rows[0].crafter_slack_received_welcome_msg = true; | |
fakeDB.client = createClient(addedCrafter) | |
fakeDatabase(fakeDB.client); | |
response = await sendWelcomeDMMessage(channel, user); | |
expect(response.body.called).toBe(false); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment