Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v5] Update config #269

Merged
merged 10 commits into from
Apr 17, 2023
7 changes: 2 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ module.exports = {
testEnvironment: "node",
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.ts$",
maxWorkers: 1,
globals: {
"ts-jest": {
isolatedModules: false
}
}
wjhsf marked this conversation as resolved.
Show resolved Hide resolved
rootDir: './lib/',
testPathIgnorePatterns: ['./lib/__tests__/data/']
};
168 changes: 168 additions & 0 deletions lib/__tests__/data/dates/bsd-examples.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
export default [
{
"test": "Sat, 15-Apr-17 21:01:22 GMT",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Thu, 19-Apr-2007 16:00:00 GMT",
"expected": "Thu, 19 Apr 2007 16:00:00 GMT"
}, {
"test": "Wed, 25 Apr 2007 21:02:13 GMT",
"expected": "Wed, 25 Apr 2007 21:02:13 GMT"
}, {
"test": "Thu, 19/Apr\\2007 16:00:00 GMT",
"expected": "Thu, 19 Apr 2007 16:00:00 GMT"
}, {
"test": "Fri, 1 Jan 2010 01:01:50 GMT",
"expected": "Fri, 01 Jan 2010 01:01:50 GMT"
}, {
"test": "Wednesday, 1-Jan-2003 00:00:00 GMT",
"expected": "Wed, 01 Jan 2003 00:00:00 GMT"
}, {
"test": ", 1-Jan-2003 00:00:00 GMT",
"expected": "Wed, 01 Jan 2003 00:00:00 GMT"
}, {
"test": " 1-Jan-2003 00:00:00 GMT",
"expected": "Wed, 01 Jan 2003 00:00:00 GMT"
}, {
"test": "1-Jan-2003 00:00:00 GMT",
"expected": "Wed, 01 Jan 2003 00:00:00 GMT"
}, {
"test": "Wed,18-Apr-07 22:50:12 GMT",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "WillyWonka , 18-Apr-07 22:50:12 GMT",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "WillyWonka , 18-Apr-07 22:50:12",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "WillyWonka , 18-apr-07 22:50:12",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "Mon, 18-Apr-1977 22:50:13 GMT",
"expected": "Mon, 18 Apr 1977 22:50:13 GMT"
}, {
"test": "Mon, 18-Apr-77 22:50:13 GMT",
"expected": "Mon, 18 Apr 1977 22:50:13 GMT"
}, {
"test": "\"Sat, 15-Apr-17\\\"21:01:22\\\"GMT\"",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Partyday, 18- April-07 22:50:12",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "Partyday, 18 - Apri-07 22:50:12",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "Wednes, 1-Januar-2003 00:00:00 GMT",
"expected": "Wed, 01 Jan 2003 00:00:00 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22 GMT-2",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22 GMT BLAH",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22 GMT-0400",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22 DST",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22 -0400",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22 (hello there)",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22 11:22:33",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 ::00 21:01:22",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 boink:z 21:01:22",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Sat, 15-Apr-17 91:22:33 21:01:22",
"expected": null
}, {
"test": "Thu Apr 18 22:50:12 2007 GMT",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "22:50:12 Thu Apr 18 2007 GMT",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "Thu 22:50:12 Apr 18 2007 GMT",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "Thu Apr 22:50:12 18 2007 GMT",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "Thu Apr 18 22:50:12 2007 GMT",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "Thu Apr 18 2007 22:50:12 GMT",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "Thu Apr 18 2007 GMT 22:50:12",
"expected": "Wed, 18 Apr 2007 22:50:12 GMT"
}, {
"test": "Sat, 15-Apr-17 21:01:22 GMT",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "15-Sat, Apr-17 21:01:22 GMT",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "15-Sat, Apr 21:01:22 GMT 17",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "15-Sat, Apr 21:01:22 GMT 2017",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "15 Apr 21:01:22 2017",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "15 17 Apr 21:01:22",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Apr 15 17 21:01:22",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "Apr 15 21:01:22 17",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "2017 April 15 21:01:22",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "15 April 2017 21:01:22",
"expected": "Sat, 15 Apr 2017 21:01:22 GMT"
}, {
"test": "98 April 17 21:01:22",
"expected": null
}, {
"test": "Thu, 012-Aug-2008 20:49:07 GMT",
"expected": null
}, {
"test": "Thu, 12-Aug-31841 20:49:07 GMT",
"expected": null
}, {
"test": "Thu, 12-Aug-9999999999 20:49:07 GMT",
"expected": null
}, {
"test": "Thu, 999999999999-Aug-2007 20:49:07 GMT",
"expected": null
}, {
"test": "Thu, 12-Aug-2007 20:61:99999999999 GMT",
"expected": null
}, {
"test": "IAintNoDateFool",
"expected": null
}
]
48 changes: 48 additions & 0 deletions lib/__tests__/data/dates/examples.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
export default [
{
"test": "Mon, 10-Dec-2007 17:02:24 GMT",
"expected": "Mon, 10 Dec 2007 17:02:24 GMT"
}, {
"test": "Wed, 09 Dec 2009 16:27:23 GMT",
"expected": "Wed, 09 Dec 2009 16:27:23 GMT"
}, {
"test": "Thursday, 01-Jan-1970 00:00:00 GMT",
"expected": "Thu, 01 Jan 1970 00:00:00 GMT"
}, {
"test": "Mon Dec 10 16:32:30 2007 GMT",
"expected": "Mon, 10 Dec 2007 16:32:30 GMT"
}, {
"test": "Wednesday, 01-Jan-10 00:00:00 GMT",
"expected": "Fri, 01 Jan 2010 00:00:00 GMT"
}, {
"test": "Mon, 10-Dec-07 20:35:03 GMT",
"expected": "Mon, 10 Dec 2007 20:35:03 GMT"
}, {
"test": "Wed, 1 Jan 2020 00:00:00 GMT",
"expected": "Wed, 01 Jan 2020 00:00:00 GMT"
}, {
"test": "Saturday, 8-Dec-2012 21:24:09 GMT",
"expected": "Sat, 08 Dec 2012 21:24:09 GMT"
}, {
"test": "Thu, 31 Dec 23:55:55 2037 GMT",
"expected": "Thu, 31 Dec 2037 23:55:55 GMT"
}, {
"test": "Sun, 9 Dec 2012 13:42:05 GMT",
"expected": "Sun, 09 Dec 2012 13:42:05 GMT"
}, {
"test": "Wed Dec 12 2007 08:44:07 GMT-0500 (EST)",
"expected": "Wed, 12 Dec 2007 08:44:07 GMT"
}, {
"test": "Mon, 01-Jan-2011 00: 00:00 GMT",
"expected": null
}, {
"test": "Sun, 1-Jan-1995 00:00:00 GMT",
"expected": "Sun, 01 Jan 1995 00:00:00 GMT"
}, {
"test": "Wednesday, 01-Jan-10 0:0:00 GMT",
"expected": "Fri, 01 Jan 2010 00:00:00 GMT"
}, {
"test": "Thu, 10 Dec 2009 13:57:2 GMT",
"expected": "Thu, 10 Dec 2009 13:57:02 GMT"
}
]
Loading