Quality Pass 2: Certificates + destination-script harness + backend/admin test coverage - #39
Merged
Merged
Conversation
…admin pages - collection.service unit test (mocked DB): update()/getById/delete NOT_FOUND, update+create ALREADY_EXISTS, field-change patch (6 tests) — closes the integration-only gap where update() was never exercised - data-source.service: create() duplicate-name ALREADY_EXISTS case - global-script.service: DB-failure Result.error case - engine destination-scripts.e2e: real TCP/MLLP send boundary proving a destination-level filter (FILTERED, no send) + transformer (rewrites wire + CT_SENT) + responseTransformer (CT_RESPONSE→CT_RESPONSE_TRANSFORMED) all work; fixed stale queueEnabled→queueMode in e2e-pipeline.test.ts - Certificates: e2e/certificates.spec.ts (real self-signed PEM) + manual checklist docs/testing/52-certificates.md (the only fully-untested UI surface) - admin component tests: AlertEditorPage + GlobalScriptsPage Server 998, engine 360, web 99; build + lint clean; e2e specs typecheck. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F1ad6jb5mCYxzFVXHbksqi
There was a problem hiding this comment.
Pull request overview
This PR is a “testing gaps” quality pass that expands coverage across the server, engine, and web admin UI, including a new destination-scripts end-to-end harness (real TCP/MLLP boundary) and first-pass Certificates UI E2E coverage plus a manual checklist.
Changes:
- Add new unit/component tests for server services and web admin pages to cover previously untested branches and interactions.
- Add engine E2E coverage for destination-level filter/transformer/responseTransformer behavior across a real TCP/MLLP send boundary, plus align an existing pipeline harness with
queueMode. - Add Certificates E2E spec and accompanying manual testing checklist documentation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/web/src/pages/tests/GlobalScriptsPage.test.tsx | Adds component-level behavior coverage for tab switching and dirty/save behavior. |
| packages/web/src/pages/tests/AlertEditorPage.test.tsx | Adds component-level coverage for create-mode rendering and form interactions. |
| packages/server/src/services/tests/global-script.service.test.ts | Adds a unit test for DB failure handling in GlobalScriptService.getAll(). |
| packages/server/src/services/tests/data-source.service.test.ts | Adds coverage for duplicate-name create() returning ALREADY_EXISTS. |
| packages/server/src/services/tests/collection.service.test.ts | Adds mocked-DB unit tests covering update/create/get/delete error branches and duplicate-name guards. |
| packages/engine/src/tests/e2e-pipeline.test.ts | Updates pipeline harness destination config to use queueMode. |
| packages/engine/src/tests/destination-scripts.e2e.test.ts | Introduces a full E2E harness validating destination filter/transform/responseTransform with stored content-type assertions. |
| e2e/certificates.spec.ts | Adds Certificates UI E2E coverage (navigate, import PEM, invalid PEM, delete). |
| docs/testing/52-certificates.md | Adds a manual checklist for Certificates behavior and scope notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+215
to
+234
| async function sendMllp(port: number, message: string): Promise<string> { | ||
| return new Promise<string>((resolve, reject) => { | ||
| const client = net.createConnection({ host: '127.0.0.1', port }, () => { | ||
| client.write(wrapMllp(message)); | ||
| }); | ||
| const parser = new MllpParser(); | ||
| client.on('data', (chunk: Buffer) => { | ||
| const msgs = parser.parse(chunk); | ||
| if (msgs.length > 0) { | ||
| client.end(); | ||
| resolve(msgs[0]!); | ||
| } | ||
| }); | ||
| client.on('error', reject); | ||
| setTimeout(() => { | ||
| client.destroy(); | ||
| reject(new Error('Timeout waiting for MLLP response')); | ||
| }, 10_000); | ||
| }); | ||
| } |
Comment on lines
+203
to
+206
| if (destServer) { | ||
| destServer.close(); | ||
| destServer = null; | ||
| } |
Comment on lines
+260
to
+266
| receiver = new TcpMllpReceiver({ | ||
| host: '127.0.0.1', | ||
| port: SOURCE_PORT, | ||
| maxConnections: 10, | ||
| // PASSTHROUGH so the (response-transformed) pipeline response reaches the source client. | ||
| responseMode: MLLP_RESPONSE_MODE.PASSTHROUGH, | ||
| } as never); |
Comment on lines
+141
to
+164
| test('delete certificate with confirmation', async ({ page }) => { | ||
| await page.goto('/certificates'); | ||
| await page.waitForTimeout(1_000); | ||
|
|
||
| const certRow = page | ||
| .locator('table tbody tr') | ||
| .filter({ hasText: TEST_CERT_NAME }) | ||
| .first(); | ||
|
|
||
| if (await certRow.isVisible()) { | ||
| // Row action is an IconButton with aria-label "Delete certificate" | ||
| const deleteBtn = certRow.getByRole('button', { name: /delete certificate/i }); | ||
| if (await deleteBtn.isVisible()) { | ||
| await deleteBtn.click(); | ||
|
|
||
| // Confirm in the ConfirmDialog (its confirm button reads "Delete") | ||
| const confirmBtn = page.getByRole('button', { name: /^delete$/i }); | ||
| await expect(confirmBtn).toBeVisible({ timeout: 10_000 }); | ||
| await confirmBtn.click(); | ||
|
|
||
| await expect(page.getByText(TEST_CERT_NAME)).not.toBeVisible({ timeout: 10_000 }); | ||
| } | ||
| } | ||
| }); |
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.
Pass 2 of the testing-gaps program — closes the highest-value coverage holes.
Server 998, engine 360, web 99; full build + lint clean; e2e specs typecheck.
Generated in parallel and each self-verified, then integrated + full-suite-verified.
🤖 Generated with Claude Code
https://claude.ai/code/session_01F1ad6jb5mCYxzFVXHbksqi