@@ -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
4959var keepQuantity ;
5060// Uniques in 'assets'
51- var uniqueFiles = 4 ;
61+ var uniqueFiles = 5 ;
5262var filteredQuantity ;
5363var 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+ ! / \/ v e n d o r - 6 1 e 0 b e 7 9 \. ( c s s | j s ) $ / . 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- / \/ ( s t y l e | v e n d o r | f o n t s t y l e | t r y - t o - t r i p - r e g e x ) - ( 1 d 8 7 b e b e | 1 1 1 1 1 1 1 1 | 0 0 0 0 0 0 0 0 ) (?: \. m i n ) ? \. c s s / . test ( file . path ) ,
115+ / \/ ( s t y l e | v e n d o r | f o n t s t y l e | t r y - t o - t r i p - r e g e x ) - ( 1 d 8 7 b e b e | 1 1 1 1 1 1 1 1 | 0 0 0 0 0 0 0 0 ) (?: \. m i n ) ? \. ( c s s | j s ) $ / . test ( file . path ) ,
100116 'should filter correct files'
101117 ) ;
102118 } ) ;
@@ -122,7 +138,7 @@ function initStream(stream) {
122138
123139function streamDataCheck ( file ) {
124140 assert (
125- / \/ ( s t y l e | v e n d o r | f o n t s t y l e | t r y - t o - t r i p - r e g e x ) - [ 0 - 9 a - f ] { 8 } (?: \. m i n ) ? \. c s s / . test ( file . path ) ,
141+ / \/ ( s t y l e | v e n d o r | f o n t s t y l e | t r y - t o - t r i p - r e g e x ) - [ 0 - 9 a - f ] { 8 } (?: \. m i n ) ? \. ( c s s | j s ) $ / . test ( file . path ) ,
126142 'should filter only revisioned files'
127143 ) ;
128144 fileCount ++ ;
0 commit comments