From e6718a85e16cfb2c9f40ba144b7dd104e5d34d80 Mon Sep 17 00:00:00 2001 From: Nick Playfair Date: Tue, 2 Feb 2021 13:12:52 +0000 Subject: [PATCH] Update tests for extractArchive --- test/index.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/index.test.js b/test/index.test.js index b8934b0..5e3f425 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -10,7 +10,7 @@ const tmpDir = path.join(__dirname, 'tmp'); // getLayers test('Promise of an array of layers from a given folder', () => { - return fileProc.getLayers2(testLayers).then(data => { + return fileProc.getLayers(testLayers).then(data => { expect(data).toEqual( expect.arrayContaining([ expect.objectContaining({ @@ -23,22 +23,22 @@ test('Promise of an array of layers from a given folder', () => { }); test('Non-existent folder should reject promise with error', () => { - return expect(fileProc.getLayers2('./invalid_folder')).rejects.toThrow('Layers folder does not exist.'); + return expect(fileProc.getLayers('./invalid_folder')).rejects.toThrow('Layers folder does not exist.'); }); test('Folder with incorrect number of layers should reject promise with error', () => { - return expect(fileProc.getLayers2(emptyFolder)).rejects.toThrow('Layer not found.'); + return expect(fileProc.getLayers(emptyFolder)).rejects.toThrow('Layer not found.'); }); // extractArchive test('Non-existent archive should throw an error', () => { - return expect(fileProc.extractArchive('invalid.zip', tmpDir)).rejects.toThrow(Error); + expect(() => fileProc.extractArchive('invalid.zip', tmpDir).toThrow(Error)); }); test('Temp dir not existing should throw an error', () => { - return expect(fileProc.extractArchive(testGerber, './invalid_dir')).rejects.toThrow(Error); + expect(() => fileProc.extractArchive(testGerber, './invalid_dir').toThrow(Error)); }); test('Should extract archive and resolve with the number of files extracted', () => { - return expect(fileProc.extractArchive(testGerber, tmpDir)).resolves.toBe(12); + expect(() => (fileProc.extractArchive(testGerber, tmpDir).toBe(12))); }); \ No newline at end of file