Files
dolt/nomdl/codegen/test/struct-test.js
Erik Arvidsson b79d89963f JS codegen: Add tests and make more things work (#1182)
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
2016-04-07 14:11:40 -07:00

21 lines
468 B
JavaScript

// @flow
import {assert} from 'chai';
import {suite, test} from 'mocha';
import {Kind} from '@attic/noms';
import {Struct} from './gen/struct.noms.js';
suite('struct.noms', () => {
test('constructor', () => {
const s: Struct = new Struct({s: 'hi', b: true});
assert.equal(s.s, 'hi');
assert.equal(s.b, true);
});
test('type', () => {
const s: Struct = new Struct({s: 'hi', b: true});
assert.equal(s.type.kind, Kind.Unresolved);
});
});