Skip to content

Commit

Permalink
tests: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Aug 30, 2014
1 parent 9b0b3f2 commit 63380cb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ describe('etag(entity)', function () {
describe('with "weak" option', function () {
describe('when "false"', function () {
it('should generate a strong ETag for a string', function () {
assert.equal(etag('', {weak: false}), '"1B2M2Y8AsgTpgAmY7PhCfg=="')
assert.equal(etag('beep boop', {weak: false}), '"Z34SGyQ2IB7YzB7HMkCjrQ=="')
})

it('should generate a strong ETag for a Buffer', function () {
assert.equal(etag(new Buffer(0), {weak: false}), '"1B2M2Y8AsgTpgAmY7PhCfg=="')
assert.equal(etag(new Buffer([1, 2, 3]), {weak: false}), '"Uonfc331cyb83SJZevsfrA=="')
})

Expand All @@ -63,10 +65,12 @@ describe('etag(entity)', function () {

describe('when "true"', function () {
it('should generate a weak ETag for a string', function () {
assert.equal(etag('', {weak: true}), 'W/"0-0"')
assert.equal(etag('beep boop', {weak: true}), 'W/"9-7f3ee715"')
})

it('should generate a weak ETag for a Buffer', function () {
assert.equal(etag(new Buffer(0), {weak: true}), 'W/"0-0"')
assert.equal(etag(new Buffer([1, 2, 3]), {weak: true}), 'W/"3-55bc801d"')
})

Expand Down

0 comments on commit 63380cb

Please sign in to comment.