mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-11 02:59:34 -06:00
Now the generated code is tested and most things work. To generate a .noms.js file use the codegen go binary Things that are not complete/needs improvements include: - Recursive structs - Structs with annonymous unions - Enum -- constants for the values Issue #1081
23 lines
720 B
JavaScript
23 lines
720 B
JavaScript
// @flow
|
|
|
|
import {assert} from 'chai';
|
|
import {suite, test} from 'mocha';
|
|
|
|
import {newSet, RefValue, makeSetType, float32Type, DataStore, MemoryStore} from '@attic/noms';
|
|
import type {NomsSet, float32} from '@attic/noms';
|
|
import {StructWithRef} from './gen/ref.noms.js';
|
|
|
|
suite('ref.noms', () => {
|
|
test('constructor', async () => {
|
|
const ds = new DataStore(new MemoryStore());
|
|
const set: NomsSet<float32> = await newSet([0, 1, 2, 3], makeSetType(float32Type));
|
|
const ref = ds.writeValue(set);
|
|
const r = new RefValue(ref);
|
|
const struct = new StructWithRef({r});
|
|
|
|
assert.isTrue(struct.r.equals(r));
|
|
const set2 = await ds.readValue(r.targetRef);
|
|
assert.isTrue(set.equals(set2));
|
|
});
|
|
});
|