Skip to content

Commit

Permalink
style: Use a better TypeScript-compatible map initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed May 26, 2022
1 parent 1b8b11c commit 4afe517
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions packages/vats/test/test-lib-chainStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,22 @@ test('makeChainStorageRoot', async t => {
t.is(rootNode.getKey(), rootKey, 'root key matches initialization input');

// Values must be strings.
/** @type { Map<string, any> } */
const nonStrings = new Map();
nonStrings.set('number', 1);
nonStrings.set('bigint', 1n);
nonStrings.set('boolean', true);
nonStrings.set('null', null);
nonStrings.set('undefined', undefined);
nonStrings.set('symbol', Symbol('foo'));
nonStrings.set('array', ['foo']);
nonStrings.set('object', {
toString() {
return 'foo';
},
});
const nonStrings = new Map(
Object.entries({
number: 1,
bigint: 1n,
boolean: true,
null: null,
undefined,
symbol: Symbol('foo'),
array: ['foo'],
object: {
toString() {
return 'foo';
},
},
}),
);
for (const [label, val] of nonStrings) {
t.throws(
() => rootNode.setValue(val),
Expand Down

0 comments on commit 4afe517

Please sign in to comment.