-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* More cache fixes Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Carlos Fuentes <me@metcoder.dev> * code review, fixes --------- Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com> Co-authored-by: Carlos Fuentes <me@metcoder.dev>
- Loading branch information
1 parent
d6f45b1
commit 6569585
Showing
90 changed files
with
1,002 additions
and
54,187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Update Cache Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
update-cache-tests: | ||
name: Update Cache Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git Config | ||
run: | | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
- name: Checkout Repository | ||
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
|
||
- name: Update Cache Tests | ||
run: | | ||
rm -rf test/fixtures/cache-tests && mkdir test/fixtures/cache-tests && | ||
git clone https://github.com/http-tests/cache-tests --depth=1 test/fixtures/tmp-cache-tests/ && | ||
mv test/fixtures/tmp-cache-tests/LICENSE test/fixtures/cache-tests/LICENSE && | ||
mv test/fixtures/tmp-cache-tests/tests test/fixtures/cache-tests/tests && | ||
mv test/fixtures/tmp-cache-tests/test-engine test/fixtures/cache-tests/test-engine && | ||
mv test/fixtures/tmp-cache-tests/results test/fixtures/cache-tests/results && | ||
rm -rf tests/fixtures/tmp-cache-tests/ | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | ||
with: | ||
base: main | ||
branch: cache-tests-update | ||
title: Update Cache Tests | ||
body: Automated update of the Cache Test Suite | ||
commit-message: "chore: update cache tests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
'use strict' | ||
|
||
import { group, bench, run } from 'mitata' | ||
import { parseHttpDate } from '../../lib/util/date.js' | ||
|
||
const DATES = [ | ||
// IMF | ||
'Sun, 06 Nov 1994 08:49:37 GMT', | ||
'Thu, 18 Aug 1950 02:01:18 GMT', | ||
'Wed, 11 Dec 2024 23:20:57 GMT', | ||
'Wed, aa Dec 2024 23:20:57 GMT', | ||
'aaa, 06 Dec 2024 23:20:57 GMT', | ||
'Wed, 01 aaa 2024 23:20:57 GMT', | ||
'Wed, 6 Dec 2024 23:20:07 GMT', | ||
'Wed, 06 Dec 2024 3:20:07 GMT', | ||
'Wed, 06 Dec 2024 23:1:07 GMT', | ||
'Wed, 06 Dec 2024 23:01:7 GMT', | ||
'Wed, 06 Dec aaaa 23:01:07 GMT', | ||
'Wed, 06 Dec 2024 aa:01:07 GMT', | ||
'Wed, 06 Dec 2024 23:aa:07 GMT', | ||
'Wed, 06 Dec 2024 23:01:aa GMT', | ||
|
||
// RFC850 | ||
'Sunday, 06-Nov-94 08:49:37 GMT', | ||
'Thursday, 18-Aug-50 02:01:18 GMT', | ||
'Wednesday, 11-Dec-24 23:20:57 GMT', | ||
'Wednesday, aa Dec 2024 23:20:57 GMT', | ||
'aaa, 06 Dec 2024 23:20:57 GMT', | ||
'Wednesday, 01-aaa-24 23:20:57 GMT', | ||
'Wednesday, 6-Dec-24 23:20:07 GMT', | ||
'Wednesday, 06-Dec-24 3:20:07 GMT', | ||
'Wednesday, 06-Dec-24 23:1:07 GMT', | ||
'Wednesday, 06-Dec-24 23:01:7 GMT', | ||
'Wednesday, 06 Dec-aa 23:01:07 GMT', | ||
'Wednesday, 06-Dec-24 aa:01:07 GMT', | ||
'Wednesday, 06-Dec-24 23:aa:07 GMT', | ||
'Wednesday, 06-Dec-24 23:01:aa GMT', | ||
|
||
// asctime() | ||
'Sun Nov 6 08:49:37 1994', | ||
'Thu Aug 18 02:01:18 1950', | ||
'Wed Dec 11 23:20:57 2024', | ||
'Wed Dec aa 23:20:57 2024', | ||
'aaa Dec 06 23:20:57 2024', | ||
'Wed aaa 01 23:20:57 2024', | ||
'Wed Dec 6 23:20:07 2024', | ||
'Wed Dec 06 3:20:07 2024', | ||
'Wed Dec 06 23:1:07 2024', | ||
'Wed Dec 06 23:01:7 2024', | ||
'Wed 06 Dec 23:01:07 aaaa', | ||
'Wed Dec 06 aa:01:07 2024', | ||
'Wed Dec 06 23:aa:07 2024', | ||
'Wed Dec 06 23:01:aa 2024' | ||
] | ||
|
||
group(() => { | ||
bench('parseHttpDate', () => { | ||
for (const date of DATES) { | ||
parseHttpDate(date) | ||
} | ||
}) | ||
|
||
bench('new Date()', () => { | ||
for (const date of DATES) { | ||
// eslint-disable-next-line no-new | ||
new Date(date) | ||
} | ||
}) | ||
}) | ||
|
||
await run() |
Oops, something went wrong.