test(integration): add component-install helper, port REST query suite - #627
Merged
Conversation
Third slice of the api-tests migration on top of #597. - utils/components.mjs: installAppComponent(client, {project, files, probePath, restartTimeoutMs}). Issues add_component, set_component_file per file, then restartHttpWorkers polling probePath. Idempotent w.r.t. "Project already exists". Will be reused by upcoming ports of 18 (computedIndexedProperties), 19 (graphQlTests), and 22 (openApi), which all rely on appGraphQL / computed / myApp111 components that the legacy 17a_addComponents step installed once for the whole sequential run. - rest.test.mjs (from tests/20_restTests.mjs): exercises Harper's REST query syntax (?key==value&select(...), nested .related.subObject.any attribute paths, 413 on oversize POST) against the appGraphQL test schema. Self-contained: installs its own trimmed appGraphQL schema (Related + SubObject only, the types this suite reads) plus the canonical Related/SubObject seed rows that legacy 19_graphQlTests inserted. - Skipped on Windows: depends on restart_service http_workers, which crashes the Harper instance on Windows (#549). Matches the existing per-suite skip pattern in headers.test.mjs. All 49 tests across the 6 ported suites pass in parallel (~12s wall). Legacy testSuite.mjs / tests/*.mjs are intentionally still in place; full cutover happens after the remaining suites are migrated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Reviewed; no blockers found. |
dawsontoth
approved these changes
May 20, 2026
kriszyp
added a commit
that referenced
this pull request
May 21, 2026
Fourth slice of the api-tests migration. Independent of #627 (no component-install dependency) — based directly on main. - token-auth.test.mjs (from tests/14_tokenAuth.mjs): create_authentication_tokens happy path + missing/invalid credentials, bearer-token search_by_hash, refresh_operation_token with valid/invalid tokens. - Self-contained: seeds a single northnwd.employees row in before() so the bearer-token search has a deterministic record. The legacy version inherited this from 2_dataLoad.mjs. - Preserves the legacy isDevEnv() branching by reading authentication.authorizeLocal from get_configuration in before(). With authorizeLocal=true (the integration framework default for loopback callers), the no-credentials call mints a token; otherwise it returns 401 "Must login". This matches the legacy test exactly. All 46 tests across the 6 ported suites pass in parallel (this branch omits the rest.test.mjs from PR #627; CI will see 49 once both land). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third slice of the api-tests migration on top of #597.
Skipped on Windows — depends on `restart_service http_workers`, which crashes the Harper instance on Windows (#549). Matches the existing skip pattern in `headers.test.mjs`.
Purpose
Unlocks the remaining component-dependent suites. The legacy `17a_addComponents.mjs` step installed `computed`, `appGraphQL`, and `myApp111` components once for the whole sequential run; suites 18 (computed indexed props), 19 (graphQL), 20 (rest), and 22 (openapi) all assumed those components were present. With `installAppComponent` in place, each of those can be ported as a self-contained file with its own component install.
Where to look
Testing
All 49 tests across the 6 ported suites pass in parallel locally:
```
npm run test:integration -- "integrationTests/apiTests/*.test.mjs"
▶ System Information ✔ (2/2)
▶ Alter User ✔ (7/7)
▶ HTTP Header / Set-Cookie handling ✔ (2/2)
▶ Transaction Logs ✔ (7/7)
▶ Transactions / audit log ✔ (19/19)
▶ REST query syntax ✔ (12/12)
ℹ pass 49 fail 0 duration_ms ~12300
```
Gemini cross-review flagged two issues — both were hallucinations (claimed a long invented directive path and a leading space in an import that don't exist in the actual file). Substantive findings (faithful port, correct helper, correct Windows skip) check out.
🤖 Generated by Claude (Opus 4.7), see commit Co-Authored-By tag.