@@ -52,7 +52,7 @@ describe("getTable", () => {
52
52
} ) ;
53
53
54
54
const key = { field2 : 1 , field3 : 2n } ;
55
- table . setRecord ( { key, record : { field1 : "hello" } } ) ;
55
+ table . setRecord ( { key, value : { field1 : "hello" } } ) ;
56
56
57
57
const encodedKey = table . encodeKey ( { key } ) ;
58
58
attest < typeof key > ( table . decodeKey ( { encodedKey } ) ) . equals ( { field2 : 1 , field3 : 2n } ) ;
@@ -151,8 +151,8 @@ describe("getTable", () => {
151
151
} ) ,
152
152
} ) ;
153
153
154
- table . setRecord ( { key : { player : 1 , match : 2 } , record : { x : 3 , y : 4 } } ) ;
155
- table . setRecord ( { key : { player : 5 , match : 6 } , record : { x : 7 , y : 8 } } ) ;
154
+ table . setRecord ( { key : { player : 1 , match : 2 } , value : { x : 3 , y : 4 } } ) ;
155
+ table . setRecord ( { key : { player : 5 , match : 6 } , value : { x : 7 , y : 8 } } ) ;
156
156
157
157
attest < { [ encodedKey : string ] : { player : number ; match : number } } > ( table . getKeys ( ) ) . snap ( {
158
158
"1|2" : { player : 1 , match : 2 } ,
@@ -203,8 +203,8 @@ describe("getTable", () => {
203
203
const stash = createStash ( ) ;
204
204
const table = stash . getTable ( { table : config } ) ;
205
205
206
- table . setRecord ( { key : { player : 1 , match : 2 } , record : { x : 3n , y : 4n } } ) ;
207
- table . setRecord ( { key : { player : 5 , match : 6 } , record : { x : 7n , y : 8n } } ) ;
206
+ table . setRecord ( { key : { player : 1 , match : 2 } , value : { x : 3n , y : 4n } } ) ;
207
+ table . setRecord ( { key : { player : 5 , match : 6 } , value : { x : 7n , y : 8n } } ) ;
208
208
209
209
attest < { [ encodedKey : string ] : { player : number ; match : number ; x : bigint ; y : bigint } } > (
210
210
table . getRecords ( ) ,
@@ -239,7 +239,7 @@ describe("getTable", () => {
239
239
table . setRecord ( {
240
240
// @ts -expect-error Property 'field2' is missing in type '{ field3: number; }'
241
241
key : { field3 : 2 } ,
242
- record : { field1 : "" } ,
242
+ value : { field1 : "" } ,
243
243
} ) ,
244
244
)
245
245
. throws ( "Provided key is missing field field2." )
@@ -249,15 +249,15 @@ describe("getTable", () => {
249
249
table . setRecord ( {
250
250
// @ts -expect-error Type 'string' is not assignable to type 'number'.
251
251
key : { field2 : 1 , field3 : "invalid" } ,
252
- record : { field1 : "" } ,
252
+ value : { field1 : "" } ,
253
253
} ) ,
254
254
) . type . errors ( `Type 'string' is not assignable to type 'number'.` ) ;
255
255
256
256
attest ( ( ) =>
257
257
table . setRecord ( {
258
258
key : { field2 : 1 , field3 : 2 } ,
259
259
// @ts -expect-error Type 'number' is not assignable to type 'string'.
260
- record : { field1 : 1 } ,
260
+ value : { field1 : 1 } ,
261
261
} ) ,
262
262
) . type . errors ( `Type 'number' is not assignable to type 'string'.` ) ;
263
263
} ) ;
@@ -314,7 +314,7 @@ describe("getTable", () => {
314
314
315
315
table1 . subscribe ( { subscriber } ) ;
316
316
317
- table1 . setRecord ( { key : { a : "0x00" } , record : { b : 1n , c : 2 } } ) ;
317
+ table1 . setRecord ( { key : { a : "0x00" } , value : { b : 1n , c : 2 } } ) ;
318
318
319
319
expect ( subscriber ) . toHaveBeenCalledTimes ( 1 ) ;
320
320
expect ( subscriber ) . toHaveBeenNthCalledWith ( 1 , {
@@ -325,10 +325,10 @@ describe("getTable", () => {
325
325
} ) ;
326
326
327
327
// Expect unrelated updates to not notify subscribers
328
- table2 . setRecord ( { key : { a : "0x01" } , record : { b : 1n , c : 2 } } ) ;
328
+ table2 . setRecord ( { key : { a : "0x01" } , value : { b : 1n , c : 2 } } ) ;
329
329
expect ( subscriber ) . toHaveBeenCalledTimes ( 1 ) ;
330
330
331
- table1 . setRecord ( { key : { a : "0x00" } , record : { b : 1n , c : 3 } } ) ;
331
+ table1 . setRecord ( { key : { a : "0x00" } , value : { b : 1n , c : 3 } } ) ;
332
332
333
333
expect ( subscriber ) . toHaveBeenCalledTimes ( 2 ) ;
334
334
expect ( subscriber ) . toHaveBeenNthCalledWith ( 2 , {
0 commit comments