Files
probot/test/resolver.test.js
2018-05-25 15:17:19 -05:00

19 lines
521 B
JavaScript

const {resolve} = require('../src/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})
})
})