Test extractArchive

This commit is contained in:
Nick Playfair 2021-02-01 23:03:34 +00:00
parent e7e2f02581
commit 702245e0bd

View File

@ -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);
});