Skip to content

Commit b27c730

Browse files
cubapCopilotthehabes
authored
114 testing testing (#115)
* Modernize testing: migrate from Jest to node:test Add a testing modernization plan and migrate test layout and CI to the new approach. Remove the legacy Jest config and delete legacy __tests__ artifacts, add a new top-level test/ suite with helpers (including test/helpers/env.js) and route test files, and update docs and CI to run the consolidated npm script (allTests) and expose targeted scripts (coreTests, existsTests, functionalTests). Dev dependencies and package metadata were adjusted to support the new runner/coverage tools. * Add Playwright e2e smoke tests and CI workflow Introduce a GitHub Actions test matrix (fast and full gates) to run CI test groups. Add a Playwright-based browser smoke test (test/e2e/ui-smoke.test.js) that launches the app and verifies basic UI flows. Update README with local instructions for running e2e (install browsers) and the ci:fast/ci:full command groups. * coverage thresholds * e2e(ui): add browser helper and new smoke tests Introduce launchBrowserOrSkip helper to centralize Chromium launch and skip logic when not installed, and refactor existing smoke test to use it. Add several end-to-end UI smoke tests: successful create submission (stubbing /create), client-side JSON validation that prevents network calls, query form results (stubbing /query), and overwrite conflict handling (stubbing /overwrite returning 409). Tests use Playwright routing to mock server responses and assert flash messages and object viewer output. * Update tokens.js * Update .github/workflows/tests.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update package.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * better test description * Validate upstream RERUM contract in tests Capture fetch URL/options in test mocks and add assertions to verify the upstream RERUM contract (URL, HTTP method, Authorization header, Content-Type). Updates test/routes/{create,delete,overwrite,query,update}.test.js to record lastFetchUrl/lastFetchOptions and assert correct endpoint/method/headers, and documents the new validation in test/TESTING.md with an example and rationale to catch breaking changes. * overwrite header inclusion * Accept application/ld+json in tests; add 415/502 cases Update test suites to accept application/ld+json by configuring express.json({ type: ['application/json', 'application/ld+json'] }) across create, query, delete, overwrite, and update tests. Add new tests: create and query now verify requests with Content-Type application/ld+json are accepted. Add tests that sending text/plain yields 415 in create, delete, overwrite, and update. Import and mount the error messenger in delete, overwrite, and update tests. Add network-failure cases that map rejected fetch to a 502 response for overwrite and update. * Update TESTING.md * test description cleanup * Easy gap to cover. Cleanup dead index.js code. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Bryan Haberberger <bryan.j.haberberger@slu.edu>
1 parent 4aaff91 commit b27c730

32 files changed

Lines changed: 2065 additions & 5339 deletions

.github/workflows/cd_dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- name: Install dependencies and run the test
5353
run: |
5454
npm install
55-
npm run functionalTests
55+
npm run allTests
5656
deploy:
5757
if: github.event.pull_request.draft == false
5858
needs:

.github/workflows/tests.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: TinyNode Test Matrix
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
fast:
14+
name: Fast Test Gate
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "24"
24+
cache: "npm"
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run fast suites
30+
run: npm run ci:fast
31+
32+
full:
33+
name: Full Test Gate
34+
needs: fast
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Setup Node.js
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: "24"
44+
cache: "npm"
45+
46+
- name: Install dependencies
47+
run: npm ci
48+
49+
- name: Run full suite and coverage
50+
run: npm run ci:full

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,26 @@ OPEN_API_CORS = false
3838

3939
Now, you can run tests
4040
```shell
41-
npm run runtest
41+
npm run allTests
42+
```
43+
44+
For fast local checks, run targeted suites:
45+
```shell
46+
npm run coreTests
47+
npm run existsTests
48+
npm run functionalTests
49+
```
50+
51+
Run browser smoke tests (optional for local development):
52+
```shell
53+
npm run e2e:install
54+
npm run E2Etests
55+
```
56+
57+
Run the CI-equivalent command groups locally:
58+
```shell
59+
npm run ci:fast
60+
npm run ci:full
4261
```
4362

4463
And start the app

jest.config.js

Lines changed: 0 additions & 211 deletions
This file was deleted.

0 commit comments

Comments
 (0)