Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest bolt receiver #24

Merged
merged 3 commits into from
Jan 10, 2020
Merged

Jest bolt receiver #24

merged 3 commits into from
Jan 10, 2020

Conversation

barlock
Copy link
Contributor

@barlock barlock commented Jan 7, 2020

Related Issue
Supports #8

Related PRs
Depends #21

What does this PR do?
New Package! I present, a bolt receiver, made just for jest. What great tests will come of this.

Description of Changes
Bolt receiver, It's got jest spies in it. It's nice.

What gif most accurately describes how I feel towards this PR?

@barlock barlock force-pushed the jest-bolt-receiver branch 5 times, most recently from 38c8551 to 94d45d1 Compare January 7, 2020 22:40
@barlock barlock force-pushed the jest-bolt-receiver branch from 94d45d1 to 171f7be Compare January 9, 2020 20:52
@barlock barlock marked this pull request as ready for review January 9, 2020 20:53
@barlock barlock mentioned this pull request Jan 10, 2020
Copy link
Collaborator

@tteltrab tteltrab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks mostly good, just some small changes and suggestions.

let app: MyApp;

beforeEach(() => {
receiver = new JestReceiver();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to do this in the beforeEach? Slows down the tests.

this works, I think, and will for most users?

describe('My Awesome App', () => {
  const receiver = new JestReceiver();
  let app: MyApp;

  beforeEach(() => {
    app = new App({ receiver, token: fields.token });
  });

  it('Can handle a slash command', async () => {
...

or you can just it in a before instead of a beforeEach if you want for setup. but ^ seems to work.

@@ -0,0 +1,80 @@
# Jest Bolt Receiver

A [receiver](https://slack.dev/bolt/concepts#receiver) built for testing Slack Bolt apps with Jest. This receiver allows you to easily send mock events to your app and write consistent tests.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a better description of what you had to do when testing before this package and after would help demonstrate the value more.

}

// For things that fall under "Base Events"
// https://github.com/slackapi/bolt/blob/1655999346077e9521722a667414758da856ede2/src/types/events/base-events.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return event;
}

// For things that fall under "Base Events"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

things?

barlock and others added 2 commits January 10, 2020 14:28
Co-Authored-By: Nick Bartlett <nbartlett7@gmail.com>
Copy link
Collaborator

@tteltrab tteltrab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if only.

@tteltrab tteltrab merged commit 2e88ee7 into master Jan 10, 2020
@tteltrab tteltrab deleted the jest-bolt-receiver branch January 10, 2020 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants