@@ -190,6 +190,14 @@ describe('negotiator.encoding(array)', function () {
190190 it ( 'should return first client-preferred encoding' , function ( ) {
191191 assert . strictEqual ( this . negotiator . encoding ( [ 'deflate' , 'compress' ] ) , 'deflate' )
192192 } )
193+
194+ it ( 'should return developer-preferred encodings' , function ( ) {
195+ assert . strictEqual ( this . negotiator . encoding ( [ 'gzip' , 'deflate' ] , [ 'deflate' ] ) , 'deflate' )
196+ assert . strictEqual ( this . negotiator . encoding ( [ 'deflate' , 'gzip' ] , [ 'deflate' ] ) , 'deflate' )
197+ assert . strictEqual ( this . negotiator . encoding ( [ 'gzip' , 'deflate' ] , [ 'gzip' ] ) , 'gzip' )
198+ assert . strictEqual ( this . negotiator . encoding ( [ 'deflate' , 'gzip' ] , [ 'gzip' ] ) , 'gzip' )
199+ assert . strictEqual ( this . negotiator . encoding ( [ 'gzip' ] , [ 'gzip' ] ) , 'gzip' )
200+ } )
193201 } )
194202
195203 whenAcceptEncoding ( 'gzip;q=0.8, deflate' , function ( ) {
@@ -204,6 +212,14 @@ describe('negotiator.encoding(array)', function () {
204212 it ( 'should return most client-preferred encoding' , function ( ) {
205213 assert . strictEqual ( this . negotiator . encoding ( [ 'gzip' ] ) , 'gzip' )
206214 assert . strictEqual ( this . negotiator . encoding ( [ 'compress' , 'identity' ] ) , 'identity' )
215+ assert . strictEqual ( this . negotiator . encoding ( [ 'gzip' , 'deflate' ] , [ 'deflate' ] ) , 'gzip' )
216+ assert . strictEqual ( this . negotiator . encoding ( [ 'deflate' , 'gzip' ] , [ 'deflate' ] ) , 'gzip' )
217+ } )
218+
219+ it ( 'should return developer-preferred encodings' , function ( ) {
220+ assert . strictEqual ( this . negotiator . encoding ( [ 'gzip' , 'deflate' ] , [ 'gzip' ] ) , 'gzip' )
221+ assert . strictEqual ( this . negotiator . encoding ( [ 'deflate' , 'gzip' ] , [ 'gzip' ] ) , 'gzip' )
222+ assert . strictEqual ( this . negotiator . encoding ( [ 'gzip' ] , [ 'gzip' ] ) , 'gzip' )
207223 } )
208224 } )
209225} )
@@ -401,6 +417,14 @@ describe('negotiator.encodings(array)', function () {
401417 assert . deepEqual ( this . negotiator . encodings ( [ 'deflate' , 'gzip' ] ) , [ 'gzip' , 'deflate' ] )
402418 assert . deepEqual ( this . negotiator . encodings ( [ 'identity' ] ) , [ 'identity' ] )
403419 } )
420+
421+ it ( 'should return developer-preferred encodings' , function ( ) {
422+ assert . deepEqual ( this . negotiator . encodings ( [ 'gzip' , 'deflate' ] , [ 'deflate' ] ) , [ 'deflate' , 'gzip' ] )
423+ assert . deepEqual ( this . negotiator . encodings ( [ 'deflate' , 'gzip' ] , [ 'deflate' ] ) , [ 'deflate' , 'gzip' ] )
424+ assert . deepEqual ( this . negotiator . encodings ( [ 'gzip' , 'deflate' ] , [ 'gzip' ] ) , [ 'gzip' , 'deflate' ] )
425+ assert . deepEqual ( this . negotiator . encodings ( [ 'deflate' , 'gzip' ] , [ 'gzip' ] ) , [ 'gzip' , 'deflate' ] )
426+ assert . deepEqual ( this . negotiator . encodings ( [ 'gzip' ] , [ 'gzip' ] ) , [ 'gzip' ] )
427+ } )
404428 } )
405429
406430 whenAcceptEncoding ( 'gzip;q=0.8, deflate' , function ( ) {
@@ -415,6 +439,14 @@ describe('negotiator.encodings(array)', function () {
415439 it ( 'should return client-preferred encodings' , function ( ) {
416440 assert . deepEqual ( this . negotiator . encodings ( [ 'gzip' ] ) , [ 'gzip' ] )
417441 assert . deepEqual ( this . negotiator . encodings ( [ 'identity' , 'gzip' , 'compress' ] ) , [ 'gzip' , 'identity' , 'compress' ] )
442+ assert . deepEqual ( this . negotiator . encodings ( [ 'gzip' , 'deflate' ] , [ 'deflate' ] ) , [ 'gzip' , 'deflate' ] )
443+ assert . deepEqual ( this . negotiator . encodings ( [ 'deflate' , 'gzip' ] , [ 'deflate' ] ) , [ 'gzip' , 'deflate' ] )
444+ } )
445+
446+ it ( 'should return developer-preferred encodings' , function ( ) {
447+ assert . deepEqual ( this . negotiator . encodings ( [ 'gzip' , 'deflate' ] , [ 'gzip' ] ) , [ 'gzip' , 'deflate' ] )
448+ assert . deepEqual ( this . negotiator . encodings ( [ 'deflate' , 'gzip' ] , [ 'gzip' ] ) , [ 'gzip' , 'deflate' ] )
449+ assert . deepEqual ( this . negotiator . encodings ( [ 'gzip' ] , [ 'gzip' ] ) , [ 'gzip' ] )
418450 } )
419451 } )
420452} )
0 commit comments