Skip to content

Commit

Permalink
fix(test): fixed up preferred encoding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleytodd committed Aug 31, 2024
1 parent 251627c commit 5221da1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Negotiator.prototype.encoding = function encoding(available, opts) {
};

Negotiator.prototype.encodings = function encodings(available, options) {
opts = options || {};
var opts = options || {};
return preferredEncodings(this.request.headers['accept-encoding'], available, opts.preferred);
};

Expand Down
8 changes: 3 additions & 5 deletions test/encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,12 @@ describe('negotiator.encoding(array)', function () {
it('should return most client-preferred encoding', function () {
assert.strictEqual(this.negotiator.encoding(['gzip']), 'gzip')
assert.strictEqual(this.negotiator.encoding(['compress', 'identity']), 'identity')
assert.strictEqual(this.negotiator.encoding(['gzip', 'deflate'], ['deflate']), 'gzip')
assert.strictEqual(this.negotiator.encoding(['deflate', 'gzip'], ['deflate']), 'gzip')
})

it('should return developer-preferred encodings', function () {
assert.strictEqual(this.negotiator.encoding(['gzip', 'deflate'], ['gzip']), 'gzip')
assert.strictEqual(this.negotiator.encoding(['deflate', 'gzip'], ['gzip']), 'gzip')
assert.strictEqual(this.negotiator.encoding(['gzip'], ['gzip']), 'gzip')
assert.strictEqual(this.negotiator.encoding(['gzip', 'deflate'], { preferred: ['gzip'] }), 'gzip')
assert.strictEqual(this.negotiator.encoding(['deflate', 'gzip'], { preferred: ['gzip'] }), 'gzip')
assert.strictEqual(this.negotiator.encoding(['gzip'], { preferred: ['gzip'] }), 'gzip')
})
})
})
Expand Down

0 comments on commit 5221da1

Please sign in to comment.