Skip to content

Commit

Permalink
TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
knocte committed Sep 1, 2024
1 parent 131a410 commit 8121feb
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions commitlint/tests/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import { runCommitLintOnMsg } from "./testHelpers.js";
import { test, expect } from "vitest";

class A {
x: string;
y: string;

constructor() {
this.x = "hello";
this.y = "hallo";
}
}
class B {
x: number;
y: number;

constructor() {
this.x = 1;
this.y = 2;
}
}

test("body-leading-blank1", () => {
let commitMsgWithoutEmptySecondLine =
"foo: this is only a title" + "\n" + "Bar baz.";
Expand All @@ -19,3 +38,23 @@ test("subject-full-stop2", () => {
let subjectFullStop2 = runCommitLintOnMsg(commitMsgWithoutEndingDotInTitle);
expect(subjectFullStop2.status).toBe(0);
});

type C = A | B;
function fn(p: C) {
if (p instanceof A) {
return p.x + p.y;
}
if (p instanceof B) {
let sub = p.y - p.x;
return sub.toString();
}
}

test("testing operators", () => {
let foo = new A();
expect(foo.x).toBe("hello");
expect(foo.y).toBe("hallo");
let bar = new B();
expect(bar.x).toBe(1);
expect(bar.y).toBe(2);
});

0 comments on commit 8121feb

Please sign in to comment.