// (C) 2007-2019 GoodData Corporation import { DateRange } from "../DateRange"; describe("DateRange", () => { describe("intersect", () => { it("should return intersection of both dates", () => { const a = new DateRange("2015-01-01", "2015-01-15"); const b = new DateRange("2015-01-10", "2015-01-30"); expect(a.intersect(b)).toEqual( DateRange.fromDates(new Date("2015-01-10"), new Date("2015-01-15")), ); }); it('shoul be "commutative" operation', () => { const a = new DateRange("2015-01-01", "2015-01-15"); const b = new DateRange("2015-01-10", "2015-01-30"); expect(a.intersect(b)).toEqual(b.intersect(a)); }); }); });