🔨 remove unsafe date parsing options from getGithubUserContribution ( thanks @Sutil )

This commit is contained in:
platane
2021-10-04 11:32:54 +02:00
committed by Platane
parent 859fd7a695
commit bedc8d0e31
3 changed files with 23 additions and 26 deletions

View File

@@ -4,7 +4,6 @@ const params = [
//
[{}, ""],
[{ year: 2017 }, "from=2017-01-01&to=2017-12-31"],
[{ from: new Date("2017-12-03") }, "from=2017-12-03"],
[{ from: "2017-12-03" }, "from=2017-12-03"],
[{ to: "2017-12-03" }, "to=2017-12-03"],
] as const;
@@ -16,5 +15,5 @@ params.forEach(([params, res]) =>
);
it("should fail if the date is in the future", () => {
expect(() => formatParams({ to: new Date() })).toThrow(Error);
expect(() => formatParams({ to: "9999-01-01" })).toThrow(Error);
});