@@ -45,7 +45,7 @@ const toPlainObject = (value: unknown): ReturnType<typeof JSON.parse> => {
4545} ;
4646
4747describe ( "A2UIModelProcessor" , ( ) => {
48- let processor ;
48+ let processor = new v0_8 . Data . A2UIModelProcessor ( ) ;
4949
5050 beforeEach ( ( ) => {
5151 processor = new v0_8 . Data . A2UIModelProcessor ( ) ;
@@ -138,7 +138,10 @@ describe("A2UIModelProcessor", () => {
138138 } ,
139139 } ,
140140 ] ) ;
141- const name = processor . getDataByPath ( "/user/name" ) ;
141+ const name = processor . getData (
142+ { dataContextPath : "/" } as v0_8 . Types . AnyComponentNode ,
143+ "/user/name"
144+ ) ;
142145 assert . strictEqual ( name , "Alice" ) ;
143146 } ) ;
144147
@@ -152,13 +155,17 @@ describe("A2UIModelProcessor", () => {
152155 } ,
153156 } ,
154157 ] ) ;
155- const user = processor . getDataByPath ( "/user" ) ;
158+ const user = processor . getData (
159+ { dataContextPath : "/" } as v0_8 . Types . AnyComponentNode ,
160+ "/user"
161+ ) ;
156162 assert . deepStrictEqual ( toPlainObject ( user ) , { name : "Bob" } ) ;
157163 } ) ;
158164
159165 it ( "should create nested structures when setting data" , ( ) => {
160- processor . setDataByPath ( "/a/b/c" , "value" ) ;
161- const data = processor . getDataByPath ( "/a/b/c" ) ;
166+ const component = { dataContextPath : "/" } as v0_8 . Types . AnyComponentNode ;
167+ processor . setData ( component , "/a/b/c" , "value" ) ;
168+ const data = processor . getData ( component , "/a/b/c" ) ;
162169 assert . strictEqual ( data , "value" ) ;
163170 } ) ;
164171
@@ -494,8 +501,9 @@ describe("A2UIModelProcessor", () => {
494501
495502 processor . processMessages ( messages ) ;
496503
497- const title = processor . getDataByPath ( "/title" , "test-surface" ) ;
498- const items = processor . getDataByPath ( "/items" , "test-surface" ) ;
504+ const component = { dataContextPath : "/" } as v0_8 . Types . AnyComponentNode ;
505+ const title = processor . getData ( component , "/title" , "test-surface" ) ;
506+ const items = processor . getData ( component , "/items" , "test-surface" ) ;
499507
500508 assert . strictEqual ( title , "My Title" ) ;
501509 assert . deepStrictEqual ( toPlainObject ( items ) , [ { id : 1 } , { id : 2 } ] ) ;
@@ -512,7 +520,8 @@ describe("A2UIModelProcessor", () => {
512520 } ,
513521 ] ) ;
514522
515- const badData = processor . getDataByPath ( "/badData" ) ;
523+ const component = { dataContextPath : "/" } as v0_8 . Types . AnyComponentNode ;
524+ const badData = processor . getData ( component , "/badData" ) ;
516525 assert . strictEqual ( badData , invalidJSON ) ;
517526 } ) ;
518527 } ) ;
0 commit comments