Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds cookie attribute assertions (fixes #259) #261

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
includes cookie key/val in attributes output
schrodervictor committed Nov 5, 2019

Verified

This commit was signed with the committer’s verified signature.
dsanders11 David Sanders
commit 82165cc1b095eb23a8190e7b344cb5742e51711d
5 changes: 3 additions & 2 deletions lib/http.js
Original file line number Diff line number Diff line change
@@ -461,7 +461,7 @@ module.exports = function (chai, _) {
areAttributesCorrect
, "expected cookie '" + key + "' to have the following attributes:"
, "expected cookie '" + key + "' to not have the following attributes:"
, normalizeKeys(attributes)
, prepareAttributesOutput(attributes, key, value)
, rawCookieToObj(rawCookie)
, true
);
@@ -540,8 +540,9 @@ module.exports = function (chai, _) {
return obj;
}

function normalizeKeys(obj) {
function prepareAttributesOutput(obj, key, value) {
var newObj = {};
newObj[key] = value;
Object.keys(obj).forEach(function(key) {
newObj[key.toLowerCase()] = obj[key];
});