diff --git a/commitlint/tests/integration.test.ts b/commitlint/tests/integration.test.ts index 7e8d3bdd..4ec99d76 100644 --- a/commitlint/tests/integration.test.ts +++ b/commitlint/tests/integration.test.ts @@ -50,6 +50,16 @@ function fn(p: C) { } } +class None {} +class Value { + value: T; + + constructor(val: T) { + this.value = val; + } +} +type Option = None | Value; + test("testing DUs", () => { let foo = new A(); expect(foo.x).toBe("hello"); @@ -63,3 +73,19 @@ test("testing DUs", () => { let bar2 = fn(bar); expect(bar2).toBe("1"); }); + +function fnO(option: Option) { + if (option instanceof None) { + return "NAH"; + } else { + let val = option.value; + return (val * val).toString(); + } +} + +test("testing Options", () => { + let foo: Option = new None(); + let bar: Option = new Value(2); + expect(fnO(foo)).toBe("NAH"); + expect(fnO(bar)).toBe("4"); +});