Skip to content

test(tools): add positive + negative tests for check tools (#327)#369

Merged
SisyphusZheng merged 1 commit into
devfrom
fix/327-check-tool-tests
Jul 9, 2026
Merged

test(tools): add positive + negative tests for check tools (#327)#369
SisyphusZheng merged 1 commit into
devfrom
fix/327-check-tool-tests

Conversation

@SisyphusZheng

Copy link
Copy Markdown
Member

What

Resolves #327. Adds unit tests for the two lint-like check tools and makes them testable without changing CLI behavior.

Changes

  • `check-type-safety.ts`: extract pure `scanSourcesForAnyIssues()` + `collectActiveSourceFiles()`; export `isCodeLine`/`Issue`/`SourceFile`; guard `main()` with `import.meta.main`.
  • `check-architecture-contract.ts`: thread an `issues` array through all assertion helpers; export the helpers + classifiers (`isProductionSource`, `isCurrentDocOrExample`, `isTextPath`, `normalizePath`) + `Issue`/`TextFile`; guard `main()` with `import.meta.main`.
  • `tools/check-type-safety.test.ts` (9 cases) + `tools/check-architecture-contract.test.ts` (15 cases): positive + negative coverage. Both test files are excluded from their own gates because they deliberately contain any-escape tokens.

Verification

  • `deno test` on both files: 24 passed.
  • `deno run --allow-read tools/check-type-safety.ts`: passed.
  • `deno run --allow-read --allow-run tools/check-architecture-contract.ts`: passed.
  • `deno fmt --check` + `deno lint`: clean on all changed files.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deploying openelement with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7714b11
Status: ✅  Deploy successful!
Preview URL: https://dbcfd3f3.lessjs.pages.dev
Branch Preview URL: https://fix-327-check-tool-tests.lessjs.pages.dev

View logs

Refactor check-type-safety.ts and check-architecture-contract.ts for
testability without changing CLI behavior:

- check-type-safety.ts: extract pure scanSourcesForAnyIssues() and
  collectActiveSourceFiles(); export isCodeLine/Issue/SourceFile; guard
  main() with import.meta.main.
- check-architecture-contract.ts: thread an issues array through all
  assertion helpers; export the helpers + classifiers (isProductionSource,
  isCurrentDocOrExample, isTextPath, normalizePath) + Issue/TextFile; guard
  main() with import.meta.main.

Add tools/check-type-safety.test.ts (9 cases) and
tools/check-architecture-contract.test.ts (15 cases) covering both passing
and failing scenarios. Both test files are excluded from their own gates
because they deliberately contain any-escape tokens.
@SisyphusZheng SisyphusZheng force-pushed the fix/327-check-tool-tests branch from d3db4c1 to 7714b11 Compare July 9, 2026 07:32
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

@SisyphusZheng SisyphusZheng merged commit 3bcaea2 into dev Jul 9, 2026
4 of 5 checks passed
@SisyphusZheng SisyphusZheng deleted the fix/327-check-tool-tests branch July 9, 2026 08:15
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.

1 participant