Skip to content

INTER-2307: Low-hanging test coverage improvements (ecosystem care)#265

Merged
JuroUhlar merged 3 commits into
mainfrom
chore/smoke-tests-cleanup
Jul 14, 2026
Merged

INTER-2307: Low-hanging test coverage improvements (ecosystem care)#265
JuroUhlar merged 3 commits into
mainfrom
chore/smoke-tests-cleanup

Conversation

@JuroUhlar

@JuroUhlar JuroUhlar commented Jul 14, 2026

Copy link
Copy Markdown
Contributor
  • Rename smokeTests.mjs to functionalTests.mjs and use functional-test terminology in the workflow.
  • Replace the redundant example dependency installation with pnpm typecheck:examples.
  • Add validateSealedResult() to unseal a stored fixture and assert identification.visitor_id.

CI fixture

The sealed-result check fails in CI when BASE64_SEALED_RESULT or BASE64_KEY is missing, but logs a skip locally so contributors do not need the fixture.

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ea8842e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 98.15% 159/162
🟢 Branches 96.84% 92/95
🟢 Functions 100% 35/35
🟢 Lines 98.11% 156/159

Test suite run success

83 tests passing in 24 suites.

Report generated by 🧪jest coverage report action from ea8842e

Show full coverage report
St File % Stmts % Branch % Funcs % Lines Uncovered Line #s
🟢 All files 98.14 96.84 100 98.11
🟢  src 98.43 98.66 100 98.41
🔴   ...edApiTypes.ts 0 0 0 0
🔴   index.ts 0 0 0 0
🟢   sealedResults.ts 100 100 100 100
🟢   ...rApiClient.ts 96.15 97.22 100 96.15 358,362
🟢   types.ts 100 100 100 100
🟢   urlUtils.ts 100 100 100 100
🟢   webhook.ts 100 100 100 100
🟢  src/errors 97.05 90 100 96.96
🟢   apiErrors.ts 100 100 100 100
🟢   ...orResponse.ts 100 100 100 100
🟢   toError.ts 87.5 88.88 100 87.5 21
🟢   unsealError.ts 100 50 100 100 10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Aligns the repository’s “functional tests” naming to “smoke tests” and extends the smoke test script with an optional sealed-results validation path that can be enabled via CI secrets.

Changes:

  • Renamed/retargeted workspace + tooling references from tests/functional-tests to tests/smoke-tests (workspace, ESLint, lockfile, workflow).
  • Updated the GitHub Actions workflow naming/job id and removed an unnecessary “install example deps” step; runs the smoke test from the new directory.
  • Added a gated validateSealedResult() step to smokeTests.mjs using unsealEventsResponse when BASE64_SEALED_RESULT + BASE64_KEY are present.

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/smoke-tests/smokeTests.mjs Adds sealed-result validation and updates imports for unsealing utilities.
tests/smoke-tests/package.json Introduces a workspace package manifest for smoke tests dependencies.
tests/smoke-tests/CHANGELOG.md Adds changelog content for the smoke-tests workspace package.
tests/smoke-tests/.env.example Documents required/optional env vars including sealed-result inputs.
tests/functional-tests/.env.example Removes the old env example as part of the rename/move.
pnpm-workspace.yaml Points pnpm workspace to tests/smoke-tests.
pnpm-lock.yaml Renames the importer key to match tests/smoke-tests.
eslint.config.mjs Updates lint file globs to the new smoke-tests path.
.github/workflows/smoke-tests.yml Renames workflow/job and retargets working directory; wires optional sealed-result secrets; removes redundant example install step.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…sult check

- Rename tests/functional-tests -> tests/smoke-tests and the workflow
  functional_tests.yml -> smoke-tests.yml (name, job id, working-directory)
- Update pnpm-workspace, eslint config, and the pnpm-lock importer key
- Remove the vestigial 'Install Dependencies for example' workflow step
- Add gated validateSealedResult() to smokeTests.mjs (skips unless
  BASE64_SEALED_RESULT + BASE64_KEY are set) with matching CI env + .env.example
@JuroUhlar
JuroUhlar force-pushed the chore/smoke-tests-cleanup branch from e0386c9 to d358015 Compare July 14, 2026 12:38
@JuroUhlar JuroUhlar changed the title chore: rename functional-tests to smoke-tests and add gated sealed-result check INTER-2307: Low-hanging test coverage improvements (ecosystem care) Jul 14, 2026
@JuroUhlar
JuroUhlar marked this pull request as ready for review July 14, 2026 13:22

@mcnulty-fp mcnulty-fp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. Just a few minor comments.

Comment thread .github/workflows/functional_tests.yml
Comment thread .github/workflows/smoke-tests.yml
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Following releases will be created using changesets from this PR:

@fingerprint/node-sdk@7.5.0

Minor Changes

  • Separate Server API errors from other request errors and strongly type the error code.

    • Added ServerApiError (extends RequestError), thrown when the Server API returns a structured error response. It narrows errorCode to the strongly typed ErrorCode and exposes responseBody: ErrorResponse.
    • Exported the ErrorCode type (the union of error codes returned by the Fingerprint Server API).
    • TooManyRequestsError now extends ServerApiError.
    • RequestError remains the base class for request-level errors and is thrown directly for non–Server-API responses (for example, errors returned by an intermediate proxy). Its errorCode stays a free-form string (a best-effort placeholder derived from statusText), exactly as before.

    This is a backward-compatible change: structured Server API errors are now instances of ServerApiError (a subclass of RequestError). error instanceof RequestError checks keep working, and errorCode stays populated on every error. To get the strictly typed errorCode, narrow to ServerApiError (if (error instanceof ServerApiError) { error.errorCode }). (808c802)

Patch Changes

  • errors: Normalize caught values into real Error instances, so errors from unseal and JSON parsing always carry a genuine Error. (5764c11)
  • Throw a RequestError instead of a top-level SdkError when a Server API error response has a non-JSON body (e.g. an HTML error page from a proxy). (b16cb93)

@JuroUhlar
JuroUhlar merged commit c2fd361 into main Jul 14, 2026
19 checks passed
@JuroUhlar
JuroUhlar deleted the chore/smoke-tests-cleanup branch July 14, 2026 16:18
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.

3 participants