import { Document , Block , Inline , Text } from '../types' ; import faker from 'faker' ; import { BLOCKS , INLINES } from '..' ; import { TopLevelBlockEnum } from '../schemaConstraints' ; describe ( 'Document' , ( ) => { it ( 'empty Document' , ( ) => { const document = { nodeType : BLOCKS . DOCUMENT , data : { } , content : [ ] , } ; } ) ; it ( 'Document with blocks' , ( ) => { const document = { nodeType : BLOCKS . DOCUMENT , data : { } , content : [ { nodeType : faker . name . title ( ) as TopLevelBlockEnum , data : { } , content : [ ] , } , ] , } ; } ) ; } ) ; describe ( 'Block' , ( ) => { it ( 'empty Block' , ( ) => { const block = { nodeType : BLOCKS . PARAGRAPH , data : { } , content : [ ] , } ; } ) ; it ( 'Block with block' , ( ) => { const block = { nodeType : BLOCKS . PARAGRAPH , data : { } , content : [ { nodeType : faker . name . title ( ) as INLINES , data : { } , content : [ ] , } , ] , } ; } ) ; it ( 'Block with text' , ( ) => { const block = { nodeType : BLOCKS . PARAGRAPH , data : { } , content : [ { nodeType : 'text' , value : 'hi' , data : { } , marks : [ ] , } , ] , } ; } ) ; } ) ; describe ( 'Inline' , ( ) => { it ( 'empty Inline' , ( ) => { const inline = { nodeType : INLINES . HYPERLINK , data : { } , content : [ ] , } ; } ) ; it ( 'Inline with inline' , ( ) => { const inline = { nodeType : INLINES . HYPERLINK , data : { } , content : [ { nodeType : faker . name . title ( ) as INLINES , data : { } , content : [ ] , } , ] , } ; } ) ; it ( 'Inline with text' , ( ) => { const inline = { nodeType : faker . name . title ( ) as INLINES , data : { } , content : [ { nodeType : 'text' , value : 'hi' , data : { } , marks : [ ] , } , ] , } ; } ) ; } ) ; describe ( 'text' , ( ) => { it ( 'instantiates text' , ( ) => { const text = { nodeType : 'text' , value : '' , data : { } , marks : [ ] , } ; } ) ; it ( 'instantiates text with marks' , ( ) => { const textWithMarks = { nodeType : 'text' , data : { } , value : '' , marks : [ { type : 'bold' } ] , } ; } ) ; } ) ;