Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('is a promise wrapper around glob', async () => {
module._glob = null;
const mockGlob = jest.fn().mockReturnValue('foo');
pify.mockReturnValue(mockGlob);
const actual = await module.glob('pattern');
expect(actual).toEqual('foo');
expect(pify).toHaveBeenCalledWith(glob);
expect(mockGlob).toHaveBeenCalledWith('pattern');
});
});
it('is a promise wrapper around fs.readFile', async () => {
module._readFile = null;
const mockReadFile = jest.fn().mockReturnValue('foo');
pify.mockReturnValue(mockReadFile);
const actual = await module.read('filepath');
expect(actual).toEqual('foo');
expect(pify).toHaveBeenCalledWith(fs.readFile);
expect(mockReadFile).toHaveBeenCalledWith('filepath');
});
});