From 702245e0bd5859c3d62106b95a7d441eebb09abc Mon Sep 17 00:00:00 2001 From: Nick Playfair Date: Mon, 1 Feb 2021 23:03:34 +0000 Subject: [PATCH] Test extractArchive --- test/index.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/index.test.js b/test/index.test.js index 9b428a7..b8934b0 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -29,3 +29,16 @@ test('Non-existent folder should reject promise with error', () => { test('Folder with incorrect number of layers should reject promise with error', () => { return expect(fileProc.getLayers2(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); +}); + +test('Temp dir not existing should throw an error', () => { + return expect(fileProc.extractArchive(testGerber, './invalid_dir')).rejects.toThrow(Error); +}); + +test('Should extract archive and resolve with the number of files extracted', () => { + return expect(fileProc.extractArchive(testGerber, tmpDir)).resolves.toBe(12); +}); \ No newline at end of file