1717const fs = require ( 'fs' ) ;
1818const path = require ( 'path' ) ;
1919const SlateTransformer = require ( './SlateTransformer' ) ;
20- const Value = require ( 'slate' ) . Value ;
2120
2221let slateTransformer = null ;
2322
@@ -51,8 +50,7 @@ function getSlateFiles() {
5150describe ( 'slate' , ( ) => {
5251 getSlateFiles ( ) . forEach ( ( [ file , jsonText ] , index ) => {
5352 it ( `converts ${ file } to and from CiceroMark` , ( ) => {
54- const slateDom = JSON . parse ( jsonText ) ;
55- const value = Value . fromJSON ( slateDom ) ;
53+ const value = JSON . parse ( jsonText ) ;
5654 const ciceroMark = slateTransformer . toCiceroMark ( value , 'json' ) ;
5755
5856 // check no changes to cicero mark
@@ -66,9 +64,9 @@ describe('slate', () => {
6664
6765 // convert the expected markdown to cicero mark and compare
6866 const expectedSlateValue = slateTransformer . fromMarkdown ( expectedMarkdown ) ;
69- expect ( expectedSlateValue . toJSON ( ) ) . toMatchSnapshot ( ) ; // (3)
67+ expect ( expectedSlateValue ) . toMatchSnapshot ( ) ; // (3)
7068 // if(mdFile === 'image') {
71- // console.log(JSON.stringify(expectedSlateValue.toJSON() , null, 4));
69+ // console.log(JSON.stringify(expectedSlateValue, null, 4));
7270 // }
7371
7472 const expectedCiceroMark = slateTransformer . toCiceroMark ( expectedSlateValue , 'json' ) ;
@@ -81,7 +79,7 @@ describe('slate', () => {
8179 expect ( ciceroMark ) . toEqual ( expectedCiceroMark ) ;
8280
8381 // check roundtrip
84- expect ( expectedSlateValue . toJSON ( ) ) . toEqual ( value . toJSON ( ) ) ;
82+ expect ( expectedSlateValue ) . toEqual ( value ) ;
8583 } ) ;
8684
8785 it ( 'converts variable to and from CiceroMark' , ( ) => {
@@ -120,12 +118,12 @@ describe('slate', () => {
120118 }
121119 } ;
122120
123- expect ( slateValue . toJSON ( ) ) . toEqual ( expectedSlateValue ) ;
121+ expect ( slateValue ) . toEqual ( expectedSlateValue ) ;
124122 } ) ;
125123
126124 it ( 'converts computed to and from CiceroMark' , ( ) => {
127125 const slateValue = slateTransformer . fromMarkdown ( 'test <computed value="bar"/>' ) ;
128- //console.log(JSON.stringify(slateValue.toJSON() , null, 4));
126+ //console.log(JSON.stringify(slateValue, null, 4));
129127 const expectedSlateValue = {
130128 'object' : 'value' ,
131129 'document' : {
@@ -158,7 +156,7 @@ describe('slate', () => {
158156 }
159157 } ;
160158
161- expect ( slateValue . toJSON ( ) ) . toEqual ( expectedSlateValue ) ;
159+ expect ( slateValue ) . toEqual ( expectedSlateValue ) ;
162160 } ) ;
163161 } ) ;
164162} ) ;
0 commit comments