Skip to content

Commit

Permalink
Unit test: use readFileSync fn instead to avoid file closed by anothe…
Browse files Browse the repository at this point in the history
…r fn
  • Loading branch information
lutfailham96 committed Jan 11, 2023
1 parent 1dd4bea commit d227dd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/zip_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ describe('Test ZIP Validation', () => {
});

it('should return false when input buffer is invalid ZIP', () => {
fs.readFile('./tmp/sample-0.rar', (error, invalidZipBuffer) => {
fs.readFileSync('./tmp/sample-0.rar', (error, invalidZipBuffer) => {
if (error) throw error;
const valid = filesig.isZip(invalidZipBuffer);
assert.equal(valid, false);
});
});

it('should return true when input buffer is valid ZIP', () => {
fs.readFile('./tmp/sample-0.zip', (error, validZipBuffer) => {
fs.readFileSync('./tmp/sample-0.zip', (error, validZipBuffer) => {
if (error) throw error;
const valid = filesig.isZip(validZipBuffer);
assert.equal(valid, true);
Expand Down

0 comments on commit d227dd5

Please sign in to comment.