Skip to content

Testing

dweller long gone edited this page May 22, 2026 · 1 revision

Testing

Certificate Gadgets currently uses TypeScript checks and the production build to protect the public package contract, browser application wiring, reusable API surface, and generated declaration files.

Run the standard checks from the main repository:

npm run check
npm run build

There is not currently a separate npm test script. Treat npm run check and npm run build as the required baseline before handing normal code changes back.

What npm run check Covers

npm run check runs:

tsc --noEmit

This verifies the TypeScript project without writing build output.

TypeScript API Contracts

The check protects exported TypeScript contracts for:

  • CertGadgetsCore from @pkistudio/certgadgets and @pkistudio/certgadgets/core.
  • CertGadgetsValidation from @pkistudio/certgadgets/validation.
  • initCertificateGadgets from @pkistudio/certgadgets/app.
  • Local PkiStudioJS viewer type definitions.

Browser Host Boundaries

The check helps keep browser application code aligned with host callback types such as network confirmation and network fetching.

VS Code-specific lifecycle, dialogs, and network transport behavior should remain outside this package and flow through host callbacks.

PKI Data Shapes

The check protects TypeScript shapes used for:

  • X.509 certificate documents.
  • Certificate tree nodes.
  • Extension details and network resources.
  • Network validation plans.
  • Validation result assessments and artifacts.

What npm run build Covers

npm run build runs:

tsc --noEmit
vite build
tsc -p tsconfig.types.json

This verifies both the browser bundle and generated declaration files.

Vite Application Entries

The production build covers the browser application entries:

  • index.html and src/main.ts for the main Certificate Gadgets app.
  • viewer.html and src/viewer.ts for the standalone PkiStudioJS viewer page.

Package Entry Points

The build verifies that package outputs can be produced for:

  • dist/core.js.
  • dist/validation.js.
  • dist/app.js.
  • dist/styles.css.

It also generates declaration files through tsconfig.types.json.

Dependency Integration

The build catches integration issues with browser-shipped dependencies such as:

  • @pkistudio/pkistudiojs.
  • asn1js.
  • pkijs.
  • pvtsutils.

What the Standard Checks Do Not Cover

The current checks do not replace full browser verification.

They do not currently cover:

  • Full browser UI interaction flows.
  • Visual regression checks.
  • Clipboard permission behavior across browsers.
  • Native save-file picker behavior and download fallback behavior.
  • Real-world certificate corpora.
  • Real-world OCSP, AIA, and CRL responder behavior.
  • CORS and proxy deployment behavior outside local development.
  • Validation artifact viewer routing across browser windows.
  • Splitter persistence and layout behavior across viewport sizes.

Use browser verification when changing menus, dialogs, clipboard flows, save behavior, tree selection, splitters, embedded PkiStudioJS behavior, extension decoding, validation actions, or artifact opening.

Suggested Browser Smoke Checks

For user-facing application changes, verify the relevant parts of this list:

  • Load fixtures/debug-certificate.der or fixtures/debug-certificate.pem.
  • Select root certificate and TBSCertificate child nodes and confirm the detail pane updates.
  • Select common extensions and confirm decoded summaries are readable.
  • Confirm the embedded ASN.1 viewer updates when DER-backed tree items are selected.
  • Save the loaded certificate as PEM.
  • Save a selected DER-backed tree item as DER.
  • Run an explicit validation action when a certificate contains a reachable AIA, OCSP, or CRL URL.
  • Confirm validation results and transcripts appear in the Validation pane.
  • Open validation artifacts in the appropriate Certificate Gadgets or ASN.1 viewer path.
  • Clear validation results and API log entries.

Related Checks

For package or release-related changes, also run:

npm run pack:dry-run

Use the local development server when browser verification is needed:

npm run dev -- --port 5173 --strictPort

Then open:

http://localhost:5173/

In VS Code, the Start certgadgets server task starts the same server.

Clone this wiki locally