Files
probot/test/resolver.js
Jason Etcovitch e7a0c5cd80 chore(tests): Migrate to Jest
* Add jest, remove mocha/expect

* Migrate all tests to Jest

* Make test pass

* Move tests into `/test/`

* Update testing docs

* Fix resolver test
2017-10-14 06:02:34 -07:00

19 lines
519 B
JavaScript

const resolve = require('../lib/resolver')
const stubPluginPath = require.resolve('./fixtures/plugin/stub-plugin')
const basedir = process.cwd()
describe('resolver', () => {
let stubResolver
beforeEach(() => {
stubResolver = jest.fn().mockReturnValue(stubPluginPath)
})
it('loads the module at the resolved path', () => {
const module = resolve('foo', {resolver: stubResolver})
expect(module).toBe(require(stubPluginPath))
expect(stubResolver).toHaveBeenCalledWith('foo', {basedir})
})
})