File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 34
34
function init ( converter ) {
35
35
function api ( key , value , attributes ) {
36
36
var result ;
37
+ if ( typeof document === 'undefined' ) {
38
+ return ;
39
+ }
37
40
38
41
// Write
39
42
Original file line number Diff line number Diff line change @@ -5,5 +5,25 @@ exports.node = {
5
5
var Cookies = require ( '../src/js.cookie' ) ;
6
6
test . ok ( ! ! Cookies . get , 'should load the Cookies API' ) ;
7
7
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 ( ) ;
8
28
}
9
29
} ;
You can’t perform that action at this time.
0 commit comments