Skip to content

Commit

Permalink
tests: use strict equality
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Aug 25, 2018
1 parent 4eb2f83 commit c09417e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Testing if spec lookups are correct.', function () {
it('All DB `compressible` types should reflect in compressible', function () {
for (var type in db) {
if (db[type].compressible !== undefined) {
assert.equal(compressible(type), db[type].compressible)
assert.strictEqual(compressible(type), db[type].compressible)
}
}
})
Expand All @@ -50,33 +50,33 @@ describe('Testing if charsets are handled correctly.', function () {
it('Charsets should be stripped off without issue', function () {
for (var type in db) {
if (db[type].compressible !== undefined) {
assert.equal(compressible(type + '; charset=utf-8'), db[type].compressible)
assert.strictEqual(compressible(type + '; charset=utf-8'), db[type].compressible)
}
}
})
})

describe('Ensuring invalid types do not cause errors.', function () {
it('No arguments should return false without error', function () {
assert.equal(compressible(), false)
assert.strictEqual(compressible(), false)
})

INVALID_TYPES.forEach(function (invalid) {
it(invalid + ' should return false without error', function () {
assert.doesNotThrow(function () {
assert.equal(compressible(invalid), false)
assert.strictEqual(compressible(invalid), false)
})
})
})
})

describe('Ensuring types are always stripped correctly.', function () {
it('Uppercase types should work', function () {
assert.equal(compressible('TEXT/HTML'), true)
assert.equal(compressible('TEXT/plain; charset="utf-8"'), true)
assert.strictEqual(compressible('TEXT/HTML'), true)
assert.strictEqual(compressible('TEXT/plain; charset="utf-8"'), true)
})

it('White-spaced types should work', function () {
assert.equal(compressible('application/json ; charset="utf-8"'), true)
assert.strictEqual(compressible('application/json ; charset="utf-8"'), true)
})
})

0 comments on commit c09417e

Please sign in to comment.