Skip to content

feat(mocks): ship mock engine — HealthcheckMockBuilder + 7 scenario fixtures#31

Open
comnam90 wants to merge 2 commits into
mainfrom
feature/mock-engine
Open

feat(mocks): ship mock engine — HealthcheckMockBuilder + 7 scenario fixtures#31
comnam90 wants to merge 2 commits into
mainfrom
feature/mock-engine

Conversation

@comnam90
Copy link
Copy Markdown
Owner

Summary

  • Fix: moves src/scripts/generate-mocks.ts to scripts/ (root level) to keep Node.js APIs out of src/ per project constraints; adds @/* path alias to tsconfig.node.json so import chains from scripts/ resolve correctly through src/ types
  • Fix: adds missing type keyword to HealthcheckRoot import in generator.ts (TS1484 / verbatimModuleSyntax)
  • Feat: commits src/lib/mocks/generator.ts and 7 pre-generated JSON fixtures in mocks/

What's included

File Change
src/lib/mocks/generator.ts importimport type (TS1484 fix)
scripts/generate-mocks.ts Moved from src/scripts/; import path updated
tsconfig.node.json Added "scripts" to include; added @/* path alias
package.json generate-mocks script updated to tsx scripts/generate-mocks.ts
mocks/*.json 7 pre-generated fixtures for all validation scenarios

Scenarios covered by the builder

File Scenario
perfect-v12.json Passing — VBR 12.1.2, encrypted SOBR, 30+ day retention
legacy-v11.json Blocker — VBR 11.x (version check fails)
blocker-aws.json Blocker — AWS Backup job targeting Vault directly
warning-unencrypted.json Warning — unencrypted job
community-edition.json Warning — Community Edition licence
low-retention.json Warning — retention below 30-day minimum
advanced-cloud.json Complex — GFS jobs + Archive Tier extent

Test plan

  • npm run build — clean (0 errors)
  • npm run test:run — 718/718 tests pass
  • npm run generate-mocks — executes from new location, writes all 7 files

🤖 Generated with Claude Code

comnam90 and others added 2 commits February 22, 2026 11:48
Move src/scripts/generate-mocks.ts to the root-level scripts/ directory
to keep Node.js APIs (fs, path, process) out of src/. Fix TS1484 in
generator.ts by adding the missing 'type' keyword to the HealthcheckRoot
import. Extend tsconfig.node.json to cover scripts/ with the @/* path
alias so imports chain correctly through src/ types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… fixtures

Builder-pattern generator covering all validation scenarios: passing v12,
legacy v11 (version blocker), AWS blocker, unencrypted job (warning),
community edition, low retention, and advanced cloud (GFS + archive tier).
Pre-generated JSON fixtures committed to mocks/ for developer convenience.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying vdc-vault-readiness with  Cloudflare Pages  Cloudflare Pages

Latest commit: 859a75f
Status: ✅  Deploy successful!
Preview URL: https://573110bd.vdc-vault-readiness.pages.dev
Branch Preview URL: https://feature-mock-engine.vdc-vault-readiness.pages.dev

View logs

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a mock data generation system for creating synthetic Veeam healthcheck JSON files to support testing and development. The implementation moves the generator script from src/scripts/ to scripts/ (root level) to properly separate Node.js tooling from browser code, adds TypeScript path alias support to tsconfig.node.json, and commits 7 pre-generated JSON fixtures covering various validation scenarios.

Changes:

  • Adds HealthcheckMockBuilder class with factory methods for generating realistic healthcheck data across 7 validation scenarios
  • Relocates mock generation script from src/scripts/ to scripts/ following project architecture constraints
  • Configures tsconfig.node.json with path aliases and scripts inclusion to support TypeScript tooling

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib/mocks/generator.ts New mock builder class with 7 static factory methods and fluent API for constructing healthcheck data
scripts/generate-mocks.ts Mock generation script relocated from src/ to maintain separation of Node.js and browser code
tsconfig.node.json Added baseUrl, paths config for @/* alias, and scripts directory to include list
package.json Added generate-mocks script and tsx ^4.21.0 dev dependency
package-lock.json Lock file updates for tsx and its dependencies (get-tsconfig, resolve-pkg-maps)
mocks/*.json 7 pre-generated fixture files for perfect, legacy, blocker, warning, community, retention, and advanced cloud scenarios

@@ -0,0 +1,579 @@
import type { HealthcheckRoot } from "../../types/healthcheck";
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HealthcheckMockBuilder class lacks test coverage. Consider adding tests that verify each static factory method (createPassingV12, createLegacyV11, etc.) generates valid HealthcheckRoot objects that successfully pass through the analyzeHealthcheck pipeline. This would ensure the mock generator produces realistic test data that aligns with the actual validation logic. The existing test infrastructure in src/tests/pipeline.test.ts provides a good pattern to follow.

Copilot uses AI. Check for mistakes.
Comment thread scripts/generate-mocks.ts
@@ -0,0 +1,29 @@
import { HealthcheckMockBuilder } from "../src/lib/mocks/generator";
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the path alias import instead of a relative path to align with the tsconfig.node.json configuration added in this PR. Change to: import { HealthcheckMockBuilder } from "@/lib/mocks/generator";

This would be consistent with the PR's stated goal of adding the @/* path alias to tsconfig.node.json for improved import resolution.

Suggested change
import { HealthcheckMockBuilder } from "../src/lib/mocks/generator";
import { HealthcheckMockBuilder } from "@/lib/mocks/generator";

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,579 @@
import type { HealthcheckRoot } from "../../types/healthcheck";
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the path alias import instead of a relative path for consistency with the newly added tsconfig.node.json configuration. Change to: import type { HealthcheckRoot } from "@/types/healthcheck";

This aligns with the project's path alias configuration and improves maintainability as the file structure changes.

Suggested change
import type { HealthcheckRoot } from "../../types/healthcheck";
import type { HealthcheckRoot } from "@/types/healthcheck";

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants