refactor(test): extract runAuditFilter helper to deduplicate audit filter tests - #5461
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the logs-audit command unit tests to reduce duplicated setup/invoke/parse boilerplate in the “filtering” test cases by introducing a shared helper.
Changes:
- Add a
runAuditFilter(...)helper within thefilteringdescribe block to encapsulate common test flow. - Refactor four filtering tests (rule/domain/decision allowed/decision denied) to use the helper.
Show a summary per file
| File | Description |
|---|---|
| src/commands/logs-audit.test.ts | Extracts a helper to deduplicate repeated audit filtering test boilerplate and updates the relevant tests to use it. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
| } | ||
|
|
||
| it('should filter by rule ID', async () => { | ||
| async function runAuditFilter(options: Omit<AuditCommandOptions, 'format'>): Promise<any[]> { |
|
@copilot address review feedback |
|
✅ Copilot review passed with no inline comments. @copilot Add the |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
|
🚀 Security Guard has started processing this pull request |
|
✅ Build Test Suite completed successfully! |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓 |
|
✅ Smoke Gemini completed. All facets verified. 💎 Smoke test in progress |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
🔌 Smoke Services — All services reachable! ✅ |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓 |
|
✅ Contribution Check completed successfully! Contribution guidelines review complete for PR #5461: no significant guideline issues found. The change is a test-only refactor, remains in the existing test file location, uses TypeScript types, does not add new functionality requiring new tests or docs, and has a clear PR description. |
|
✅ Smoke Claude passed |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
🔬 Smoke Test Results — PASS
PR: refactor(test): extract runAuditFilter helper to deduplicate audit filter tests Overall: ✅ PASS
|
Smoke Test: Copilot PAT Auth — FAIL
Overall: FAIL — template variables ( PR: "refactor(test): extract runAuditFilter helper to deduplicate audit filter tests" | Author:
|
Smoke Test: Claude Engine Validation
Overall result: PASS
|
|
Smoke Test: Copilot BYOK (Direct Mode) — PASS ✅
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy sidecar.
|
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
🔭 Smoke Test: API Proxy OpenTelemetry Tracing
All scenarios pass. ✅
|
|
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) Overall: PASS
|
Smoke Test Results
Overall: FAIL —
|
This comment has been minimized.
This comment has been minimized.
Chroot Version Comparison Results
Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
|
Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra Overall: PASS
|
Smoke Test Results (Gemini)
Overall status: PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Four audit filter tests repeated identical setup/invoke/parse boilerplate, differing only in the filter option and assertion. Extracts a
runAuditFilterhelper that owns the common flow, letting each test express only what's unique.Changes
src/commands/logs-audit.test.ts— addsrunAuditFilter(options: Omit<AuditCommandOptions, 'format'>): Promise<any[]>inside thefilteringdescribe block; refactors the four filter tests to use it