File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 3434 function init ( converter ) {
3535 function api ( key , value , attributes ) {
3636 var result ;
37+ if ( typeof document === 'undefined' ) {
38+ return ;
39+ }
3740
3841 // Write
3942
Original file line number Diff line number Diff line change @@ -5,5 +5,25 @@ exports.node = {
55 var Cookies = require ( '../src/js.cookie' ) ;
66 test . ok ( ! ! Cookies . get , 'should load the Cookies API' ) ;
77 test . done ( ) ;
8+ } ,
9+ should_not_throw_error_for_set_call_in_node : function ( test ) {
10+ test . expect ( 0 ) ;
11+ var Cookies = require ( '../src/js.cookie' ) ;
12+ Cookies . set ( 'anything' ) ;
13+ Cookies . set ( 'anything' , { path : '' } ) ;
14+ test . done ( ) ;
15+ } ,
16+ should_not_throw_error_for_get_call_in_node : function ( test ) {
17+ test . expect ( 0 ) ;
18+ var Cookies = require ( '../src/js.cookie' ) ;
19+ Cookies . get ( 'anything' ) ;
20+ test . done ( ) ;
21+ } ,
22+ should_not_throw_error_for_remove_call_in_node : function ( test ) {
23+ test . expect ( 0 ) ;
24+ var Cookies = require ( '../src/js.cookie' ) ;
25+ Cookies . remove ( 'anything' ) ;
26+ Cookies . remove ( 'anything' , { path : '' } ) ;
27+ test . done ( ) ;
828 }
929} ;
You can’t perform that action at this time.
0 commit comments