Skip to content

Commit

Permalink
Update serialize.js
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey authored Oct 7, 2024
1 parent dc0323a commit 3fcd126
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('cookie.serialize(name, value, options)', function () {
describe('with "encode" option', function () {
it('should throw on non-function value', function () {
assert.throws(cookie.serialize.bind(cookie, 'foo', 'bar', { encode: 42 }),
/the encode option expected a function but received 42/)
/option encode is invalid/)
})

it('should specify alternative value encoder', function () {
Expand All @@ -136,12 +136,12 @@ describe('cookie.serialize(name, value, options)', function () {
describe('with "expires" option', function () {
it('should throw on non-Date value', function () {
assert.throws(cookie.serialize.bind(cookie, 'foo', 'bar', { expires: 42 }),
/42 is not a valid value for the expires option/)
/option expires is invalid/)
})

it('should throw on invalid date', function () {
assert.throws(cookie.serialize.bind(cookie, 'foo', 'bar', { expires: new Date(NaN) }),
/Invalid Date is not a valid value for the expires option/)
/option expires is invalid/)
})

it('should set expires to given date', function () {
Expand All @@ -165,13 +165,13 @@ describe('cookie.serialize(name, value, options)', function () {
it('should throw when not a number', function () {
assert.throws(function () {
cookie.serialize('foo', 'bar', { maxAge: 'buzz' })
}, /buzz is not a valid value for the maxAge option/)
}, /option maxAge is invalid/)
})

it('should throw when Infinity', function () {
assert.throws(function () {
cookie.serialize('foo', 'bar', { maxAge: Infinity })
}, /Infinity is not a valid value for the maxAge option/)
}, /option maxAge is invalid/)
})

it('should set max-age to value', function () {
Expand Down Expand Up @@ -251,13 +251,13 @@ describe('cookie.serialize(name, value, options)', function () {
it('should throw on invalid priority', function () {
assert.throws(function () {
cookie.serialize('foo', 'bar', { priority: 'foo' })
}, /foo is not a valid value for the priority option/)
}, /option priority is invalid/)
})

it('should throw on non-string', function () {
assert.throws(function () {
cookie.serialize('foo', 'bar', { priority: 42 })
}, /42 is not a valid value for the priority option/)
}, /option priority is invalid/)
})

it('should set priority low', function () {
Expand All @@ -280,7 +280,7 @@ describe('cookie.serialize(name, value, options)', function () {
it('should throw on invalid sameSite', function () {
assert.throws(function () {
cookie.serialize('foo', 'bar', { sameSite: 'foo' })
}, /foo is not a valid value for the sameSite option/)
}, /option sameSite is invalid/)
})

it('should set sameSite strict', function () {
Expand Down

0 comments on commit 3fcd126

Please sign in to comment.