mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-11 10:33:08 -06:00
* JS CodeGen: Add newSetOfT etc This generates convenience functions for new list/set/map. Issue #1081
26 lines
599 B
JavaScript
26 lines
599 B
JavaScript
// @flow
|
|
|
|
import {assert} from 'chai';
|
|
import {suite, test} from 'mocha';
|
|
|
|
import {OptionalStruct} from './gen/struct_optional.noms.js';
|
|
|
|
suite('struct_optional.noms', () => {
|
|
test('constructor', async () => {
|
|
const os = new OptionalStruct({});
|
|
assert.isUndefined(os.s);
|
|
assert.isUndefined(os.b);
|
|
|
|
const os2 = os.setS('hi');
|
|
assert.equal(os2.s, 'hi');
|
|
assert.isUndefined(os2.b);
|
|
|
|
const os3 = os2.setB(true);
|
|
assert.equal(os3.s, 'hi');
|
|
assert.equal(os3.b, true);
|
|
|
|
const os4 = os2.setB(undefined).setS(undefined);
|
|
assert.isTrue(os4.equals(os));
|
|
});
|
|
});
|