forked from sindresorhus/file-type
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
26 lines (26 loc) · 876 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Generated by LiveScript 1.5.0
(function(){
var fs, join, test, readChunk, fileType, check, fixtureFiles, testFile, i$, len$;
fs = require('fs');
join = require('path').join;
test = require('ava');
readChunk = require('read-chunk');
fileType = require('.');
check = function(filename){
var file, ref$;
file = join(__dirname, 'fixture', filename);
return (ref$ = fileType(readChunk.sync(file, 0, 4 + 4096))) != null ? ref$.ext : void 8;
};
fixtureFiles = fs.readdirSync(__dirname + "/fixture");
testFile = function(t, ext, filename){
return t.is(ext, check(filename));
};
for (i$ = 0, len$ = fixtureFiles.length; i$ < len$; ++i$) {
(fn$.call(this, fixtureFiles[i$]));
}
function fn$(filename){
var ref$, ext;
ref$ = /\.([^.]+)$/.exec(filename), ext = ref$[1];
test(ext, testFile, ext, filename);
}
}).call(this);