Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Oct 8, 2024
1 parent 3357666 commit 661b48d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/parse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,19 @@ describe("cookie.parse(str)", function () {

it("should URL-decode values", function () {
expect(cookie.parse('foo="bar=123456789&name=Magic+Mouse"')).toEqual({
foo: "bar=123456789&name=Magic+Mouse",
foo: '"bar=123456789&name=Magic+Mouse"',
});

expect(cookie.parse("email=%20%22%2c%3b%2f")).toEqual({ email: ' ",;/' });
});

it("should parse quoted values", function () {
expect(cookie.parse('foo="bar"')).toEqual({ foo: "bar" });
expect(cookie.parse('foo=" a b c "')).toEqual({ foo: " a b c " });
});

it("should trim whitespace around key and value", function () {
expect(cookie.parse(' foo = "bar" ')).toEqual({ foo: "bar" });
expect(cookie.parse(' foo = "bar" ')).toEqual({ foo: '"bar"' });
expect(cookie.parse(" foo = bar ; fizz = buzz ")).toEqual({
foo: "bar",
fizz: "buzz",
});
expect(cookie.parse(' foo = " a b c " ')).toEqual({ foo: " a b c " });
expect(cookie.parse(' foo = " a b c " ')).toEqual({ foo: '" a b c "' });
expect(cookie.parse(" = bar ")).toEqual({ "": "bar" });
expect(cookie.parse(" foo = ")).toEqual({ foo: "" });
expect(cookie.parse(" = ")).toEqual({ "": "" });
Expand Down

0 comments on commit 661b48d

Please sign in to comment.