Skip to content

Commit

Permalink
migrate to jest
Browse files Browse the repository at this point in the history
  • Loading branch information
sallycsy committed Oct 30, 2017
1 parent 845ec28 commit bac68e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions package.json
Expand Up @@ -4,7 +4,7 @@
"description": "A Probot extension that adds slash commands to GitHub",
"main": "index.js",
"scripts": {
"test": "mocha && standard"
"test": "jest"
},
"repository": {
"type": "git",
Expand All @@ -14,13 +14,12 @@
"license": "ISC",
"homepage": "https://github.com/probot/commands",
"devDependencies": {
"expect": "^1.20.2",
"mocha": "^3.4.1",
"jest": "^21.2.1",
"standard": "^10.0.2"
},
"standard": {
"env": [
"mocha"
"jest"
]
}
}
7 changes: 3 additions & 4 deletions test/index.js
@@ -1,5 +1,4 @@
const {EventEmitter} = require('events')
const expect = require('expect')
const commands = require('..')

describe('commands', () => {
Expand All @@ -11,7 +10,7 @@ describe('commands', () => {
}

beforeEach(() => {
callback = expect.createSpy()
callback = jest.fn()
robot = new EventEmitter()
commands(robot, 'foo', callback)
})
Expand All @@ -32,7 +31,7 @@ describe('commands', () => {

it('does not call callback for other commands', () => {
robot.emit('issue_comment.created', payload('hello world\n\n/nope nothing to see'))
expect(callback).toNotHaveBeenCalled()
expect(callback).not.toHaveBeenCalled()
})

it('invokes command on issue edit', () => {
Expand All @@ -41,6 +40,6 @@ describe('commands', () => {
robot.emit('issue_comment.updated', event)
robot.emit('issue_comment.deleted', event)

expect(callback).toNotHaveBeenCalled()
expect(callback).not.toHaveBeenCalled()
})
})

0 comments on commit bac68e5

Please sign in to comment.