From bac68e5d190174287a6da27e107bd28716f3af79 Mon Sep 17 00:00:00 2001 From: summerhopes Date: Mon, 30 Oct 2017 23:03:58 +0800 Subject: [PATCH] migrate to jest --- package.json | 7 +++---- test/index.js | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index b93a745..8f164de 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" ] } } diff --git a/test/index.js b/test/index.js index 795fb5e..7b1eb1a 100644 --- a/test/index.js +++ b/test/index.js @@ -1,5 +1,4 @@ const {EventEmitter} = require('events') -const expect = require('expect') const commands = require('..') describe('commands', () => { @@ -11,7 +10,7 @@ describe('commands', () => { } beforeEach(() => { - callback = expect.createSpy() + callback = jest.fn() robot = new EventEmitter() commands(robot, 'foo', callback) }) @@ -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', () => { @@ -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() }) })