@@ -31,6 +31,60 @@ describe('convert-nodes', () => {
3131 fields : [ ] ,
3232 } ) ;
3333 } ) ;
34+ it ( 'Should convert to external node when variant=default' , ( ) => {
35+ const internalNode : InternalNode = {
36+ id : 'node-1' ,
37+ type : 'collection' ,
38+ position : { x : 100 , y : 200 } ,
39+ data : {
40+ title : 'some-title' ,
41+ fields : [ ] ,
42+ variant : {
43+ type : 'default' ,
44+ } ,
45+ } ,
46+ } ;
47+
48+ const result = convertToExternalNode ( internalNode ) ;
49+ expect ( result ) . toEqual ( {
50+ id : 'node-1' ,
51+ type : 'collection' as NodeType ,
52+ position : { x : 100 , y : 200 } ,
53+ title : 'some-title' ,
54+ fields : [ ] ,
55+ variant : {
56+ type : 'default' ,
57+ } ,
58+ } ) ;
59+ } ) ;
60+ it ( 'Should convert to external node when variant=warn' , ( ) => {
61+ const internalNode : InternalNode = {
62+ id : 'node-1' ,
63+ type : 'collection' ,
64+ position : { x : 100 , y : 200 } ,
65+ data : {
66+ title : 'some-title' ,
67+ fields : [ ] ,
68+ variant : {
69+ type : 'warn' ,
70+ warnMessage : 'This is a warning' ,
71+ } ,
72+ } ,
73+ } ;
74+
75+ const result = convertToExternalNode ( internalNode ) ;
76+ expect ( result ) . toEqual ( {
77+ id : 'node-1' ,
78+ type : 'collection' as NodeType ,
79+ position : { x : 100 , y : 200 } ,
80+ title : 'some-title' ,
81+ fields : [ ] ,
82+ variant : {
83+ type : 'warn' ,
84+ warnMessage : 'This is a warning' ,
85+ } ,
86+ } ) ;
87+ } ) ;
3488 } ) ;
3589
3690 describe ( 'convertToExternalNodes' , ( ) => {
@@ -141,6 +195,68 @@ describe('convert-nodes', () => {
141195 } ,
142196 } ) ;
143197 } ) ;
198+ it ( 'Should be handle node variant=default' , ( ) => {
199+ const node = {
200+ id : 'node-1' ,
201+ type : 'table' as const ,
202+ position : { x : 100 , y : 200 } ,
203+ title : 'some-title' ,
204+ fields : [ ] ,
205+ selectable : true ,
206+ variant : {
207+ type : 'default' as const ,
208+ } ,
209+ } ;
210+ const result = convertToInternalNode ( node ) ;
211+ expect ( result ) . toEqual ( {
212+ id : 'node-1' ,
213+ type : 'table' ,
214+ position : { x : 100 , y : 200 } ,
215+ connectable : false ,
216+ selectable : true ,
217+ data : {
218+ title : 'some-title' ,
219+ fields : [ ] ,
220+ borderVariant : undefined ,
221+ disabled : undefined ,
222+ variant : {
223+ type : 'default' ,
224+ } ,
225+ } ,
226+ } ) ;
227+ } ) ;
228+ it ( 'Should be handle node variant=warn' , ( ) => {
229+ const node = {
230+ id : 'node-1' ,
231+ type : 'table' as const ,
232+ position : { x : 100 , y : 200 } ,
233+ title : 'some-title' ,
234+ fields : [ ] ,
235+ selectable : true ,
236+ variant : {
237+ type : 'warn' as const ,
238+ warnMessage : 'This is a warning' ,
239+ } ,
240+ } ;
241+ const result = convertToInternalNode ( node ) ;
242+ expect ( result ) . toEqual ( {
243+ id : 'node-1' ,
244+ type : 'table' ,
245+ position : { x : 100 , y : 200 } ,
246+ connectable : false ,
247+ selectable : true ,
248+ data : {
249+ title : 'some-title' ,
250+ fields : [ ] ,
251+ borderVariant : undefined ,
252+ disabled : undefined ,
253+ variant : {
254+ type : 'warn' ,
255+ warnMessage : 'This is a warning' ,
256+ } ,
257+ } ,
258+ } ) ;
259+ } ) ;
144260 } ) ;
145261
146262 describe ( 'convertToInternalNodes' , ( ) => {
0 commit comments