Files
probot/test/resolver.test.js
tcbyrd 30af8747c2 Refactor imports and exports and fix tests
Convert the rest of the files in `/src` and disable allowJs

Move everything to named exports

Update bin to use named exports

Make all tests js and use named exports
2018-02-25 20:42:25 -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})
})
})