From be798feebba6c3474b4411b6500e9bfe4b3ecf80 Mon Sep 17 00:00:00 2001 From: Essential Randomness Date: Sat, 17 Jan 2026 21:25:47 -0800 Subject: [PATCH 1/3] fix tests and add more data validation checks --- .../workflows/data-refresh-validation.yaml | 45 + .github/workflows/data-refresh.yaml | 15 + .../mocks/data/ao3/series/1728802/index.html | 6 +- .../mocks/data/ao3/series/2817877/index.html | 8 +- .../mocks/data/ao3/series/2946579/index.html | 6 +- .../{02.html => 03.html} | 110 +-- .../01.html | 14 +- .../02.html | 16 +- .../03.html | 12 +- tests/mocks/data/ao3/tags/56312666/feed.atom | 6 +- .../works.html | 754 ++++++++------- .../works.html | 6 +- .../index.html | 6 +- .../works.html | 811 ++++++++-------- .../Court Lady Go (Mr!d! Queen)/works.html | 6 +- .../data/ao3/tags/Eventual Romance/index.html | 6 +- .../data/ao3/tags/Eventual Romance/works.html | 810 ++++++++-------- .../index.html | 6 +- .../works.html | 6 +- .../index.html | 6 +- .../works.html | 6 +- .../index.html | 6 +- .../works.html | 6 +- .../data/ao3/tags/Mind Palace/index.html | 6 +- .../data/ao3/tags/Mind Palace/works.html | 22 +- .../ao3/tags/No Fandom - Freeform/index.html | 6 +- .../ao3/tags/No Fandom - Freeform/works.html | 6 +- .../Original Senator Characters/index.html | 6 +- .../Original Senator Characters/works.html | 10 +- .../data/ao3/tags/Sherlock Holmes/works.html | 35 +- .../data/ao3/tags/The Lorax (2012)/index.html | 6 +- .../data/ao3/tags/The Lorax (2012)/works.html | 10 +- .../data/ao3/tags/Worldbuilding/index.html | 4 +- .../data/ao3/tags/Worldbuilding/works.html | 379 ++++---- .../ao3/tags/a shit ton of angst/index.html | 4 +- .../ao3/tags/a shit ton of angst/works.html | 892 +++++++++--------- .../index.html | 6 +- .../works.html | 6 +- .../data/ao3/users/astolat/profile/index.html | 10 +- .../ao3/users/franzeska/profile/index.html | 6 +- .../mocks/data/ao3/works/15461226/index.html | 6 +- tests/mocks/data/ao3/works/168768/index.html | 10 +- .../ao3/works/17793689/chapters/41980418.html | 10 +- .../ao3/works/17793689/chapters/42035519.html | 10 +- .../mocks/data/ao3/works/23824891/index.html | 10 +- .../mocks/data/ao3/works/29046888/index.html | 10 +- tests/mocks/data/ao3/works/323217/index.html | 10 +- .../ao3/works/37214506/chapters/92848687.html | 10 +- tests/mocks/data/ao3/works/3738184/index.html | 10 +- .../mocks/data/ao3/works/41237499/index.html | 8 +- .../mocks/data/ao3/works/41289660/index.html | 10 +- .../data/ao3/works/43703871/navigate.html | 4 +- tests/mocks/data/ao3/works/4491333/index.html | 8 +- .../works/48582418/chapters/122861680.html | 10 +- .../mocks/data/ao3/works/49733128/index.html | 8 +- tests/mocks/data/ao3/works/6475531/index.html | 10 +- tests/mocks/data/ao3/works/923647/index.html | 10 +- .../data/superlove/works/1269/index.html | 10 +- tests/mocks/scripts/redownload-articles.mts | 8 +- tests/tag-search.test.ts | 12 +- tests/tags.test.ts | 173 ++-- tests/work-chapter.test.ts | 10 +- 62 files changed, 2311 insertions(+), 2143 deletions(-) create mode 100644 .github/workflows/data-refresh-validation.yaml rename tests/mocks/data/ao3/tag-search/commit=search tags__tag_search[fandoms]=__tag_search[name]=an unusual__tag_search[sort_column]=name__tag_search[sort_direction]=asc__tag_search[type]=__tag_search[wrangling_status]=/{02.html => 03.html} (69%) diff --git a/.github/workflows/data-refresh-validation.yaml b/.github/workflows/data-refresh-validation.yaml new file mode 100644 index 00000000..a3932324 --- /dev/null +++ b/.github/workflows/data-refresh-validation.yaml @@ -0,0 +1,45 @@ +name: Validate data refresh PR + +on: + pull_request: + branches: [main] + types: [opened, synchronize, reopened] + +jobs: + validate-data-refresh: + runs-on: ubuntu-latest + if: startsWith(github.head_ref, 'data-refresh-') + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + data-refresh-check: + runs-on: ubuntu-latest + needs: [validate-data-refresh] + if: always() + + steps: + - name: Determine result + run: | + if [[ "${{ needs.validate-data-refresh.result }}" == "failure" ]]; then + echo "❌ Data refresh validation failed!" + echo "Tests are failing - please fix before merging." + exit 1 + elif [[ "${{ needs.validate-data-refresh.result }}" == "success" ]]; then + echo "✅ Data refresh validation passed!" + else + echo "⏭️ Data refresh validation skipped (not a data-refresh PR)" + fi diff --git a/.github/workflows/data-refresh.yaml b/.github/workflows/data-refresh.yaml index 3e2da6fb..6afdf5c8 100644 --- a/.github/workflows/data-refresh.yaml +++ b/.github/workflows/data-refresh.yaml @@ -137,6 +137,13 @@ jobs: Changes look _yikes_? ❌ Check out this PR and go get 'em! 💪🔥` }); + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.data.number, + labels: ['data-refresh'] + }); + create-failure-pr-and-issue: runs-on: ubuntu-latest needs: [test-data, update-snapshots] @@ -189,3 +196,11 @@ jobs: Want to learn more about this issue and help us fix it? Check out the [README](https://github.com/FujoWebDev/AO3.js/blob/main/README.md#about--data-refresh-tests-failed-issues) for more information!` }); + + // Add label to the PR for easy identification + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.data.number, + labels: ['data-refresh'] + }); diff --git a/tests/mocks/data/ao3/series/1728802/index.html b/tests/mocks/data/ao3/series/1728802/index.html index d5bf80a7..2e0f9df7 100644 --- a/tests/mocks/data/ao3/series/1728802/index.html +++ b/tests/mocks/data/ao3/series/1728802/index.html @@ -34,7 +34,7 @@ - + @@ -57,7 +57,7 @@

Log In

@@ -972,7 +978,7 @@