@@ -22,6 +22,42 @@ describe('ConstructorioID', function () {
2222 var cookieData = session . set_cookie ( 'mewantcookie' , 'meeatcookie' ) ;
2323 expect ( cookieData ) . to . match ( / m e w a n t c o o k i e = m e e a t c o o k i e ; e x p i r e s = .* ; p a t h = \/ / ) ;
2424 } ) ;
25+
26+ it ( 'should create a cookie without secure flag using defaults' , function ( ) {
27+ var session = new ConstructorioID ( ) ;
28+ var cookieData = session . set_cookie ( 'mewantcookie' , 'meeatcookie' ) ;
29+ expect ( cookieData ) . to . not . match ( / m e w a n t c o o k i e = m e e a t c o o k i e ; e x p i r e s = .* ; p a t h = \/ ; s e c u r e / ) ;
30+ } ) ;
31+
32+ it ( 'should create a cookie with secure flag' , function ( ) {
33+ var session = new ConstructorioID ( { cookie_secure : true } ) ;
34+ var cookieData = session . set_cookie ( 'mewantcookie' , 'meeatcookie' ) ;
35+ expect ( cookieData ) . to . match ( / m e w a n t c o o k i e = m e e a t c o o k i e ; e x p i r e s = .* ; p a t h = \/ ; s e c u r e / ) ;
36+ } ) ;
37+
38+ it ( 'should create a cookie without samesite flag using defaults' , function ( ) {
39+ var session = new ConstructorioID ( ) ;
40+ var cookieData = session . set_cookie ( 'mewantcookie' , 'meeatcookie' ) ;
41+ expect ( cookieData ) . to . not . match ( / m e w a n t c o o k i e = m e e a t c o o k i e ; e x p i r e s = .* ; p a t h = \/ ; s a m e s i t e / ) ;
42+ } ) ;
43+
44+ it ( 'should create a cookie with samesite flag' , function ( ) {
45+ var session = new ConstructorioID ( { cookie_samesite : 'strict' } ) ;
46+ var cookieData = session . set_cookie ( 'mewantcookie' , 'meeatcookie' ) ;
47+ expect ( cookieData ) . to . match ( / m e w a n t c o o k i e = m e e a t c o o k i e ; e x p i r e s = .* ; p a t h = \/ ; s a m e s i t e = s t r i c t / ) ;
48+ } ) ;
49+
50+ it ( 'should create a cookie with samesite flag' , function ( ) {
51+ var session = new ConstructorioID ( { cookie_samesite : 'lax' } ) ;
52+ var cookieData = session . set_cookie ( 'mewantcookie' , 'meeatcookie' ) ;
53+ expect ( cookieData ) . to . match ( / m e w a n t c o o k i e = m e e a t c o o k i e ; e x p i r e s = .* ; p a t h = \/ ; s a m e s i t e = l a x / ) ;
54+ } ) ;
55+
56+ it ( 'should create a cookie with samesite and secure flags' , function ( ) {
57+ var session = new ConstructorioID ( { cookie_samesite : 'strict' , cookie_secure : true } ) ;
58+ var cookieData = session . set_cookie ( 'mewantcookie' , 'meeatcookie' ) ;
59+ expect ( cookieData ) . to . match ( / m e w a n t c o o k i e = m e e a t c o o k i e ; e x p i r e s = .* ; p a t h = \/ ; s e c u r e ; s a m e s i t e = s t r i c t / ) ;
60+ } ) ;
2561 } ) ;
2662
2763 describe ( 'get_cookie' , function ( ) {
0 commit comments