UNPKG

@johnf/react-native-owl

Version:
21 lines (20 loc) 717 B
"use strict"; var _fs = require("fs"); var _fileExists = require("./file-exists.js"); describe('file-exists.ts', () => { const accessMock = jest.spyOn(_fs.promises, 'access'); beforeEach(() => { accessMock.mockReset(); }); it('should check if a file exists - true', async () => { accessMock.mockResolvedValueOnce(); const result = await (0, _fileExists.fileExists)('./hello.txt'); expect(result).toBe(true); }); it('should check if a file exists - false', async () => { accessMock.mockRejectedValueOnce(undefined); const result = await (0, _fileExists.fileExists)('./file-does-not-exist.txt'); expect(result).toBe(false); }); }); //# sourceMappingURL=file-exists.test.js.map