@@ -55,11 +55,13 @@ describe('.read()', () => {
5555 } ) ;
5656
5757 test ( 'can read within a "con" node' , ( ) => {
58- const doc = Model . create ( s . obj ( {
59- con : s . con ( {
60- foo : [ 1 , 2 , 3 ]
58+ const doc = Model . create (
59+ s . obj ( {
60+ con : s . con ( {
61+ foo : [ 1 , 2 , 3 ] ,
62+ } ) ,
6163 } ) ,
62- } ) )
64+ ) ;
6365 expect ( doc . api . read ( '/con/foo/1' ) ) . toBe ( 2 ) ;
6466 } ) ;
6567} ) ;
@@ -139,16 +141,16 @@ describe('.add()', () => {
139141 test ( 'can set key to a complex value' , ( ) => {
140142 const doc = createTypedModel ( ) ;
141143 expect ( doc . api . read ( '/obj/newKey' ) ) . toBe ( undefined ) ;
142- doc . api . add ( '/obj/newKey' , { nested : { deep : { value : 4 } } } ) ;
143- expect ( doc . api . read ( '/obj/newKey' ) ) . toEqual ( { nested : { deep : { value : 4 } } } ) ;
144+ doc . api . add ( '/obj/newKey' , { nested : { deep : { value : 4 } } } ) ;
145+ expect ( doc . api . read ( '/obj/newKey' ) ) . toEqual ( { nested : { deep : { value : 4 } } } ) ;
144146 expect ( ( doc . $ . obj as any ) . newKey . $ instanceof ObjApi ) . toBe ( true ) ;
145147 } ) ;
146148
147149 test ( 'can specify exact schema for the new value' , ( ) => {
148150 const doc = createTypedModel ( ) ;
149151 expect ( doc . api . read ( '/obj/newKey' ) ) . toBe ( undefined ) ;
150- doc . api . add ( '/obj/newKey' , s . con ( { nested : { deep : { value : 4 } } } ) ) ;
151- expect ( doc . api . read ( '/obj/newKey' ) ) . toEqual ( { nested : { deep : { value : 4 } } } ) ;
152+ doc . api . add ( '/obj/newKey' , s . con ( { nested : { deep : { value : 4 } } } ) ) ;
153+ expect ( doc . api . read ( '/obj/newKey' ) ) . toEqual ( { nested : { deep : { value : 4 } } } ) ;
152154 expect ( ( doc . $ . obj as any ) . newKey . $ instanceof ConApi ) . toBe ( true ) ;
153155 } ) ;
154156 } ) ;
@@ -186,7 +188,7 @@ describe('.add()', () => {
186188 expect ( doc . api . read ( '/arr/1' ) ) . toBe ( 'asdf' ) ;
187189 expect ( success ) . toBe ( true ) ;
188190 } ) ;
189-
191+
190192 test ( 'can add element to the beginning of array (on "arr" node)' , ( ) => {
191193 const doc = createTypedModel ( ) ;
192194 expect ( doc . api . read ( '/arr/0' ) ) . toBe ( 'asdf' ) ;
@@ -306,23 +308,35 @@ describe('.add()', () => {
306308
307309 describe ( '"val" node' , ( ) => {
308310 test ( 'when parent is wrapped in "val" node' , ( ) => {
309- const doc = Model . create ( s . obj ( {
310- obj : s . val ( s . obj ( {
311- foo : s . str ( 'bar' ) ,
312- } ) ) ,
313- } ) ) ;
311+ const doc = Model . create (
312+ s . obj ( {
313+ obj : s . val (
314+ s . obj ( {
315+ foo : s . str ( 'bar' ) ,
316+ } ) ,
317+ ) ,
318+ } ) ,
319+ ) ;
314320 expect ( doc . view ( ) ) . toEqual ( { obj : { foo : 'bar' } } ) ;
315321 const success1 = doc . api . add ( '/obj/foo' , 'baz' ) ;
316322 expect ( doc . view ( ) ) . toEqual ( { obj : { foo : 'baz' } } ) ;
317323 expect ( success1 ) . toBe ( true ) ;
318324 } ) ;
319325
320326 test ( 'when parent is wrapped in "val" node three times' , ( ) => {
321- const doc = Model . create ( s . obj ( {
322- obj : s . val ( s . val ( s . val ( s . obj ( {
323- foo : s . str ( 'bar' ) ,
324- } ) ) ) ) ,
325- } ) ) ;
327+ const doc = Model . create (
328+ s . obj ( {
329+ obj : s . val (
330+ s . val (
331+ s . val (
332+ s . obj ( {
333+ foo : s . str ( 'bar' ) ,
334+ } ) ,
335+ ) ,
336+ ) ,
337+ ) ,
338+ } ) ,
339+ ) ;
326340 expect ( doc . view ( ) ) . toEqual ( { obj : { foo : 'bar' } } ) ;
327341 const success1 = doc . api . add ( '/obj/foo' , 'baz' ) ;
328342 expect ( doc . view ( ) ) . toEqual ( { obj : { foo : 'baz' } } ) ;
@@ -363,7 +377,7 @@ describe('.replace()', () => {
363377 expect ( success ) . toBe ( false ) ;
364378 } ) ;
365379 } ) ;
366-
380+
367381 describe ( '"arr" node' , ( ) => {
368382 test ( 'can replace "val" value in "arr" node' , ( ) => {
369383 const doc = createTypedModel ( ) ;
0 commit comments