Files
probot/test/resolver.test.js
Ben Scott d712141868 Refer to instances of ApplicationFunction as appFn (#633)
Stop using the names 'plugin' and 'app' to refer to instances of
ApplicationFunction.

This renames all variable names, but leaves the plugins folder in place,
to be renamed later
2018-08-02 14:47:27 -04:00

19 lines
518 B
JavaScript

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