@@ -3,17 +3,17 @@ import { describe, it, expect } from "vitest";
33import {
44 getCookieOptions ,
55 TWENTY_NINE_DAYS ,
6- MAX_COOKIE_LENGTH ,
76 GLOBAL_COOKIE_OPTIONS ,
87} from "./getCookieOptions" ;
8+ import { storageSettings } from "../sessionManager/index" ;
99
1010describe ( "getCookieOptions" , ( ) => {
1111 it ( "returns the default configuration when no options provided" , ( ) => {
1212 const result = getCookieOptions ( ) ;
1313
1414 expect ( result ) . toMatchObject ( {
1515 maxAge : TWENTY_NINE_DAYS ,
16- maxCookieLength : MAX_COOKIE_LENGTH ,
16+ maxCookieLength : storageSettings . maxLength ,
1717 sameSite : "lax" ,
1818 httpOnly : true ,
1919 path : "/" ,
@@ -27,15 +27,13 @@ describe("getCookieOptions", () => {
2727 path : "/custom" ,
2828 maxAge : 60 ,
2929 domain : "example.com" ,
30- customOption : "value" ,
3130 } ) ;
3231
3332 expect ( result . secure ) . toBe ( true ) ;
3433 expect ( result . sameSite ) . toBe ( "none" ) ;
3534 expect ( result . path ) . toBe ( "/custom" ) ;
3635 expect ( result . maxAge ) . toBe ( 60 ) ;
3736 expect ( result . domain ) . toBe ( "example.com" ) ;
38- expect ( result . customOption ) . toBe ( "value" ) ;
3937 } ) ;
4038
4139 it ( "preserves GLOBAL_COOKIE_OPTIONS when not overridden" , ( ) => {
@@ -61,16 +59,6 @@ describe("getCookieOptions", () => {
6159 expect ( result . sameSite ) . toBe ( "lax" ) ;
6260 expect ( result . path ) . toBe ( "/" ) ;
6361 } ) ;
64-
65- it ( "supports custom passthrough options" , ( ) => {
66- const result = getCookieOptions ( {
67- customFlag : true ,
68- anotherOption : "test" ,
69- } ) ;
70-
71- expect ( result . customFlag ) . toBe ( true ) ;
72- expect ( result . anotherOption ) . toBe ( "test" ) ;
73- } ) ;
7462} ) ;
7563
7664describe ( "GLOBAL_COOKIE_OPTIONS" , ( ) => {
@@ -79,6 +67,6 @@ describe("GLOBAL_COOKIE_OPTIONS", () => {
7967 expect ( GLOBAL_COOKIE_OPTIONS . sameSite ) . toBe ( "lax" ) ;
8068 expect ( GLOBAL_COOKIE_OPTIONS . path ) . toBe ( "/" ) ;
8169 expect ( GLOBAL_COOKIE_OPTIONS . maxAge ) . toBe ( TWENTY_NINE_DAYS ) ;
82- expect ( GLOBAL_COOKIE_OPTIONS . maxCookieLength ) . toBe ( MAX_COOKIE_LENGTH ) ;
70+ expect ( GLOBAL_COOKIE_OPTIONS . maxCookieLength ) . toBe ( storageSettings . maxLength ) ;
8371 } ) ;
8472} ) ;
0 commit comments