Commit fe4f628
test: add Vitest test suite for data files and layout logic (#25)
* test: add Vitest test suite for data files and layout logic
Agent-Logs-Url: https://github.com/modkaffes/personal-website/sessions/a75038f3-51bc-495b-b6f4-be4c8b4729cc
Co-authored-by: modkaffes <1829897+modkaffes@users.noreply.github.com>
* ci: add GitHub Actions workflow to run tests on push and PRs
Agent-Logs-Url: https://github.com/modkaffes/personal-website/sessions/35360265-f4f0-425d-8a83-250299db98af
Co-authored-by: modkaffes <1829897+modkaffes@users.noreply.github.com>
* fix: address PR review comments — centralize site config and fix unsafe describe labels
Agent-Logs-Url: https://github.com/modkaffes/personal-website/sessions/469cd379-fbec-425b-ba0d-dacc394a26fe
Co-authored-by: modkaffes <1829897+modkaffes@users.noreply.github.com>
* fix: address second round of review comments — rename astro config and use toMatch assertions
Agent-Logs-Url: https://github.com/modkaffes/personal-website/sessions/e7692af8-736c-426e-9580-2a668f2e2641
Co-authored-by: modkaffes <1829897+modkaffes@users.noreply.github.com>
* chore: pin CI actions to commit SHAs and revert node to lts
* test: exercise real OG image logic and drop unused vitest aliases
The layout tests previously re-implemented `new URL(image, base)` inline,
so they validated the built-in URL constructor rather than Layout.astro's
own behavior — a regression in the layout would not have failed them.
Extract the OG image URL resolution into a shared `resolveImageUrl` helper
in site-config.ts and call it from both Layout.astro and the test, so the
suite now covers the production code path. Also:
- add a case for resolving against an explicitly provided base URL
- switch the default-prop assertions to `toMatch(/\S/)` for consistency
with the JSON data tests
- remove the three unused path aliases from vitest.config.ts
Verified: 93 tests pass and the build emits the correct absolute og:image.
* ci: run build, restrict token permissions, cancel superseded runs
Harden and broaden the CI workflow:
- add `npm run build` so compile/build regressions are caught (the prior
config-rename bug would have slipped past a test-only pipeline)
- set `permissions: contents: read` to drop the GITHUB_TOKEN down to the
minimum this read-only job needs
- add a concurrency group keyed on the ref with cancel-in-progress, so a
new push to a branch/PR cancels the now-stale run and saves CI minutes
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: modkaffes <1829897+modkaffes@users.noreply.github.com>
Co-authored-by: Modestos Kaffes <modkaffes@hackthebox.eu>1 parent cd70ec8 commit fe4f628
12 files changed
Lines changed: 585 additions & 8 deletions
File tree
- .github/workflows
- src
- data
- layouts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments