hardlounge/test/client/js/helpers/ircmessageparser/anyIntersection.ts
Max Leiter dd05ee3a65
TypeScript and Vue 3 (#4559)
Co-authored-by: Eric Nemchik <eric@nemchik.com>
Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
2022-06-18 17:25:21 -07:00

29 lines
799 B
TypeScript

import {expect} from "chai";
import anyIntersection from "../../../../../client/js/helpers/ircmessageparser/anyIntersection";
describe("anyIntersection", () => {
it("should not intersect on edges", () => {
const a = {start: 1, end: 2};
const b = {start: 2, end: 3};
expect(anyIntersection(a, b)).to.equal(false);
expect(anyIntersection(b, a)).to.equal(false);
});
it("should intersect on overlapping", () => {
const a = {start: 0, end: 3};
const b = {start: 1, end: 2};
expect(anyIntersection(a, b)).to.equal(true);
expect(anyIntersection(b, a)).to.equal(true);
});
it("should not intersect", () => {
const a = {start: 0, end: 1};
const b = {start: 2, end: 3};
expect(anyIntersection(a, b)).to.equal(false);
expect(anyIntersection(b, a)).to.equal(false);
});
});