Skip to content

Commit

Permalink
Check that MIME type is present in the tests (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Zherdev authored and sindresorhus committed Apr 16, 2019
1 parent 005bb1d commit a462568
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test.js
Expand Up @@ -8,8 +8,7 @@ import fileType from '.';

const check = (ext, name) => {
const file = path.join(__dirname, 'fixture', `${(name || 'fixture')}.${ext}`);
const fileInfo = fileType(readChunk.sync(file, 0, 4 + 4096)) || {};
return fileInfo.ext;
return fileType(readChunk.sync(file, 0, 4 + 4096)) || {};
};

const types = [
Expand Down Expand Up @@ -195,7 +194,9 @@ const names = {
};

const testFile = (t, type, name) => {
t.is(check(type, name), type);
const {ext, mime} = check(type, name);
t.is(ext, type);
t.is(typeof mime, 'string');
};

const testFileFromStream = async (t, ext, name) => {
Expand Down

0 comments on commit a462568

Please sign in to comment.