Skip to content

Commit f9a65da

Browse files
committed
0.0.7
1 parent 2d45781 commit f9a65da

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-rev-outdated",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "Old static asset revision files filter",
55
"license": "MIT",
66
"repository": {

test.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ var assets = [
2424
{path: 'css/vendor-11111111.css', time: 1111111111111},
2525
{path: 'css/vendor-11111111.min.css', time: 1111111111111},
2626
{path: 'css/vendor-00000000.css', time: 0},
27+
// Additional unique another type file
28+
{path: 'css/vendor.js', time: 0},
29+
{path: 'css/vendorxxx.js', time: 0},
30+
{path: 'css/vendor-22222222.js', time: 1403184415416},
31+
{path: 'css/vendor-61e0be79.js', time: 1403184377571},
32+
{path: 'css/vendor-a42f5380.js', time: 1403184303451},
33+
{path: 'css/vendor-1d87bebe.js', time: 1222222222222},
34+
{path: 'css/vendor-11111111.js', time: 1111111111111},
35+
{path: 'css/vendor-11111111.min.js', time: 1111111111111},
36+
{path: 'css/vendor-00000000.js', time: 0},
2737
// Test nested files
2838
{path: 'css/fonts/fontstyle.css', time: 0},
2939
{path: 'css/fonts/fontstylexxx.css', time: 0},
@@ -48,11 +58,11 @@ var assets = [
4858

4959
var keepQuantity;
5060
// Uniques in 'assets'
51-
var uniqueFiles = 4;
61+
var uniqueFiles = 5;
5262
var filteredQuantity;
5363
var fileCount;
5464

55-
it('should filter 15 files', function (cb) {
65+
it('should filter 30 files', function (cb) {
5666
keepQuantity = 1;
5767
filteredQuantity = 7 * uniqueFiles - keepQuantity * uniqueFiles;
5868
fileCount = 0;
@@ -69,14 +79,20 @@ it('should filter 15 files', function (cb) {
6979
stream.end();
7080
});
7181

72-
it('should filter 12 files using default keepQuantity option', function (cb) {
82+
it('should filter 25 files of different types using default keepQuantity option', function (cb) {
7383
keepQuantity = undefined;
7484
filteredQuantity = 7 * uniqueFiles - 2 * uniqueFiles;
7585
fileCount = 0;
7686

7787
var stream = initStream(revOutdated());
7888

79-
stream.on('data', streamDataCheck);
89+
stream.on('data', function (file) {
90+
streamDataCheck(file);
91+
assert(
92+
!/\/vendor-61e0be79\.(css|js)$/.test(file.path),
93+
'should filter correct files'
94+
);
95+
});
8096

8197
stream.on('end', function () {
8298
assert.equal(fileCount, filteredQuantity, 'Only ' + filteredQuantity + ' files should pass through the stream');
@@ -96,7 +112,7 @@ it('should filter correct files', function (cb) {
96112
stream.on('data', function (file) {
97113
streamDataCheck(file);
98114
assert(
99-
/\/(style|vendor|fontstyle|try-to-trip-regex)-(1d87bebe|11111111|00000000)(?:\.min)?\.css/.test(file.path),
115+
/\/(style|vendor|fontstyle|try-to-trip-regex)-(1d87bebe|11111111|00000000)(?:\.min)?\.(css|js)$/.test(file.path),
100116
'should filter correct files'
101117
);
102118
});
@@ -122,7 +138,7 @@ function initStream(stream) {
122138

123139
function streamDataCheck(file) {
124140
assert(
125-
/\/(style|vendor|fontstyle|try-to-trip-regex)-[0-9a-f]{8}(?:\.min)?\.css/.test(file.path),
141+
/\/(style|vendor|fontstyle|try-to-trip-regex)-[0-9a-f]{8}(?:\.min)?\.(css|js)$/.test(file.path),
126142
'should filter only revisioned files'
127143
);
128144
fileCount++;

0 commit comments

Comments
 (0)