Skip to content

Commit 31400e2

Browse files
committed
Update tests
1 parent c42e3e0 commit 31400e2

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export function stringifyCookie(
176176
const value = enc(val);
177177

178178
if (!cookieValueRegExp.test(value)) {
179-
throw new TypeError(`cookie val is invalid: ${val}`);
179+
throw new TypeError(`cookie value is invalid: ${val}`);
180180
}
181181

182182
if (str) str += "; ";

‎src/stringify-cookie.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ describe("cookie.stringifyCookie", () => {
110110

111111
it("should error on invalid values", () => {
112112
expect(() => stringifyCookie({ test: ";" }, { encode: (x) => x })).toThrow(
113-
/cookie val is invalid/,
113+
/cookie value is invalid/,
114114
);
115115
});
116116

@@ -154,7 +154,7 @@ describe("cookie.stringifyCookie", () => {
154154
it("should throw when custom encoder produces invalid value", () => {
155155
expect(() =>
156156
stringifyCookie({ foo: "bar" }, { encode: () => "invalid value" }),
157-
).toThrow(/cookie val is invalid/);
157+
).toThrow(/cookie value is invalid/);
158158
});
159159
});
160160

‎src/stringify-set-cookie.spec.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe("cookie.stringifySetCookie", () => {
8282
["foo\tbar"],
8383
])("should throw for invalid name: %s", (name) => {
8484
expect(() => stringifySetCookie({ name, value: "bar" })).toThrow(
85-
/argument name is invalid/,
85+
/cookie name is invalid/,
8686
);
8787
});
8888

@@ -110,7 +110,7 @@ describe("cookie.stringifySetCookie", () => {
110110
])("should throw for invalid domain: %s", (domain) => {
111111
expect(() =>
112112
stringifySetCookie({ name: "foo", value: "bar", domain }),
113-
).toThrow(/option domain is invalid/);
113+
).toThrow(/cookie domain is invalid/);
114114
});
115115
});
116116

@@ -149,7 +149,7 @@ describe("cookie.stringifySetCookie", () => {
149149
(value) => {
150150
expect(() =>
151151
stringifySetCookie({ name: "foo", value }, { encode: (x) => x }),
152-
).toThrow(/argument val is invalid/);
152+
).toThrow(/cookie value is invalid/);
153153
},
154154
);
155155
});
@@ -162,7 +162,7 @@ describe("cookie.stringifySetCookie", () => {
162162
value: "bar",
163163
expires: new Date(NaN),
164164
}),
165-
).toThrow(/option expires is invalid/);
165+
).toThrow(/cookie expires is invalid/);
166166
});
167167

168168
it("should set expires to given date", () => {
@@ -184,7 +184,7 @@ describe("cookie.stringifySetCookie", () => {
184184
])("should throw when maxAge is %s", (_label, maxAge) => {
185185
expect(() =>
186186
stringifySetCookie({ name: "foo", value: "bar", maxAge } as any),
187-
).toThrow(/option maxAge is invalid/);
187+
).toThrow(/cookie maxAge is invalid/);
188188
});
189189

190190
it("should set max-age to value", () => {
@@ -223,7 +223,7 @@ describe("cookie.stringifySetCookie", () => {
223223
])("should throw for invalid path: %s", (path) => {
224224
expect(() =>
225225
stringifySetCookie({ name: "foo", value: "bar", path }),
226-
).toThrow(/option path is invalid/);
226+
).toThrow(/cookie path is invalid/);
227227
});
228228
});
229229

@@ -260,7 +260,7 @@ describe("cookie.stringifySetCookie", () => {
260260
])("should throw on %s", (_label, priority) => {
261261
expect(() =>
262262
stringifySetCookie({ name: "foo", value: "bar", priority } as any),
263-
).toThrow(/option priority is invalid/);
263+
).toThrow(/cookie priority is invalid/);
264264
});
265265

266266
it.each([
@@ -287,7 +287,7 @@ describe("cookie.stringifySetCookie", () => {
287287
value: "bar",
288288
sameSite: "foo" as any,
289289
}),
290-
).toThrow(/option sameSite is invalid/);
290+
).toThrow(/cookie sameSite is invalid/);
291291
});
292292

293293
it.each([

0 commit comments

Comments
 (0)