@@ -15,44 +15,57 @@ import {
15
15
16
16
import Immutable from 'immutable' ;
17
17
18
+ const path = require ( 'path' ) ;
19
+
18
20
describe ( 'load' , ( ) => {
19
- expect ( load ( 'mytest.ipynb' ) ) . to . deep . equal ( { type : 'LOAD' , filename : 'mytest.ipynb' } )
21
+ it ( 'loads a notebook' , ( ) => {
22
+ expect ( load ( 'mytest.ipynb' ) )
23
+ . to . deep . equal ( { type : 'LOAD' , filename : 'mytest.ipynb' } )
24
+ } )
20
25
} )
21
26
22
27
describe ( 'newNotebook' , ( ) => {
23
- expect ( newNotebook ( 'python3' , '/tmp' ) )
24
- . to . deep . equal ( {
25
- type : 'NEW_NOTEBOOK' ,
26
- kernelSpecName : 'python3' ,
27
- cwd : '/tmp' ,
28
- } )
28
+ it ( 'creates a new notebook' , ( ) => {
29
+ expect ( newNotebook ( 'python3' , '/tmp' ) )
30
+ . to . deep . equal ( {
31
+ type : 'NEW_NOTEBOOK' ,
32
+ kernelSpecName : 'python3' ,
33
+ cwd : '/tmp' ,
34
+ } )
35
+ } )
29
36
} )
30
37
31
38
describe ( 'notebookLoaded' , ( ) => {
32
- expect ( notebookLoaded ( 'test' , dummyCommutable ) )
33
- . to . deep . equal ( {
34
- type : 'SET_NOTEBOOK' ,
35
- filename : 'test' ,
36
- notebook : dummyCommutable ,
37
- } )
39
+ it ( 'sets a notebook' , ( ) => {
40
+ expect ( notebookLoaded ( 'test' , dummyCommutable ) )
41
+ . to . deep . equal ( {
42
+ type : 'SET_NOTEBOOK' ,
43
+ filename : 'test' ,
44
+ notebook : dummyCommutable ,
45
+ } )
46
+ } )
38
47
} )
39
48
40
49
describe ( 'extractNewKernel' , ( ) => {
41
- expect ( extractNewKernel ( '/tmp/test.ipynb' , dummyCommutable ) ) . to . deep . equal ( {
42
- type : 'LAUNCH_KERNEL' ,
43
- kernelSpecName : 'python3' ,
44
- cwd : '/tmp' ,
50
+ it ( 'extracts and launches the kernel from a notebook' , ( ) => {
51
+ expect ( extractNewKernel ( '/tmp/test.ipynb' , dummyCommutable ) ) . to . deep . equal ( {
52
+ type : 'LAUNCH_KERNEL' ,
53
+ kernelSpecName : 'python3' ,
54
+ cwd : path . resolve ( '/tmp' ) ,
55
+ } )
45
56
} )
46
57
} )
47
58
48
59
describe ( 'convertRawNotebook' , ( ) => {
49
- const converted = convertRawNotebook ( {
50
- filename : '/tmp/test.ipynb' ,
51
- data : dummy ,
52
- } ) ;
53
- expect ( converted . filename ) . to . equal ( '/tmp/test.ipynb' ) ;
54
-
55
- const notebook = converted . notebook ;
56
- expect ( dummyCommutable . get ( 'metadata' ) . equals ( notebook . get ( 'metadata' ) ) )
57
- . to . be . true ;
60
+ it ( 'converts a raw notebook' , ( ) => {
61
+ const converted = convertRawNotebook ( {
62
+ filename : '/tmp/test.ipynb' ,
63
+ data : dummy ,
64
+ } ) ;
65
+ expect ( converted . filename ) . to . equal ( '/tmp/test.ipynb' ) ;
66
+
67
+ const notebook = converted . notebook ;
68
+ expect ( dummyCommutable . get ( 'metadata' ) . equals ( notebook . get ( 'metadata' ) ) )
69
+ . to . be . true ;
70
+ } )
58
71
} )
0 commit comments