This repository has been archived by the owner on Apr 18, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
83 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
var vows = require('should'); | ||
var path = require('path'); | ||
|
||
describe('Digester', function () { | ||
var digester = require('../src/digester'); | ||
|
||
describe('digest directory', function () { | ||
var entries, error; | ||
|
||
before(function (done) { | ||
var opts = { | ||
root: __dirname, | ||
fileFilter: ["*.gif"], | ||
silent: true | ||
}; | ||
|
||
digester.process(opts, cb); | ||
|
||
function cb (err, res) { | ||
error = err; | ||
entries = res; | ||
done(); | ||
} | ||
}); | ||
|
||
it('entries should be an array', function () { | ||
entries.should.be.an.instanceOf(Array); | ||
}); | ||
|
||
it('entries should be .gif', function () { | ||
entries.forEach(isGif); | ||
|
||
function isGif(e) { | ||
path.extname(e.fullPath).should.equal(".gif"); | ||
} | ||
}); | ||
|
||
it('entries should sorted by fullPath', function () { | ||
var paths = entries.map(toPath).sort(); | ||
|
||
entries.forEach(checkSort); | ||
|
||
function toPath(e) { | ||
return e.fullPath; | ||
} | ||
|
||
function checkSort(e, i, arr) { | ||
e.fullPath.should.equal(paths[i]); | ||
} | ||
}); | ||
|
||
it('entries should have properties', function () { | ||
entries.forEach(verify); | ||
|
||
function verify (e) { | ||
e.should.have.property('fullPath'); | ||
e.should.have.property('key'); | ||
e.should.have.property('url'); | ||
e.should.have.property('mtime'); | ||
e.should.have.property('digest'); | ||
e.should.have.property('route'); | ||
} | ||
}); | ||
}); | ||
}); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.