diff --git a/package.json b/package.json index 2c1bb87..008cd6a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "standard": { "parser": "babel-eslint", "env": { - "jasmine": true, + "jest": true, "node": true } }, diff --git a/spec/main.spec.js b/spec/main.spec.js index b1392a9..afbcdec 100644 --- a/spec/main.spec.js +++ b/spec/main.spec.js @@ -10,17 +10,17 @@ const expectedJson = JSON.stringify(ids.map(_id => buildObject({ _id })), null, describe('main', () => { beforeEach(() => { - spyOn(fs, 'readFile').and.callFake((file, charset, cb) => cb(null, csv)) - spyOn(fs, 'writeFile').and.callFake((file, dict, cb) => cb()) + jest.spyOn(fs, 'readFile').mockImplementation((file, charset, cb) => cb(null, csv)) + jest.spyOn(fs, 'writeFile').mockImplementation((file, dict, cb) => cb()) }) it('reads the given file', async () => { - await main(csvFilename).catch(fail) - expect(fs.readFile).toHaveBeenCalledWith(csvFilename, 'utf8', jasmine.any(Function)) + await main(csvFilename) + expect(fs.readFile).toHaveBeenCalledWith(csvFilename, 'utf8', expect.any(Function)) }) it('writes output to fragmentarium.json', async () => { - await main(csvFilename).catch(fail) - expect(fs.writeFile).toHaveBeenCalledWith(jsonFileName, expectedJson, jasmine.any(Function)) + await main(csvFilename) + expect(fs.writeFile).toHaveBeenCalledWith(jsonFileName, expectedJson, expect.any(Function)) }) })