Files
dolt/nomdl/codegen/test/enum-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

18 lines
473 B
JavaScript

// @flow
import {assert} from 'chai';
import {suite, test} from 'mocha';
import {EnumStruct} from './gen/enum_struct.noms.js';
import type {Handedness} from './gen/enum_struct.noms.js';
suite('enum_struct.noms', () => {
test('constructor', async () => {
const es = new EnumStruct({hand: 0});
assert.equal(es.hand, 0);
const hand: Handedness = es.hand;
assert.equal(es.hand, hand);
const es2 = es.setHand(1);
assert.equal(es2.hand, 1);
});
});