Skip to content

docs(testing): revamp testing guide and remove broken template tests#1063

Closed
toiroakr wants to merge 7 commits into
mainfrom
chore/testing-docs
Closed

docs(testing): revamp testing guide and remove broken template tests#1063
toiroakr wants to merge 7 commits into
mainfrom
chore/testing-docs

Conversation

@toiroakr

Copy link
Copy Markdown
Contributor

Summary

  • Rewrite packages/sdk/docs/testing.md into a Unit/E2E two-layer model. Replaces the previous Unit/Bundled/Workflow split, fixes broken vitest imports, and drops references to a non-existent --template testing. Examples cover resolvers (simple, TailorDB mocks, DI, wait-point resume) and workflow jobs (simple, trigger mocks, wait-point mocks, full-workflow integration), all anchored on the actual resolver and workflow templates.
  • Mark createImportMain from @tailor-platform/sdk/test as @deprecated. It is an SDK-internal helper for verifying bundled output; applications should test their TypeScript source directly (unit) and verify deployed behavior via E2E. The export stays in place for now and example/tests/createImportMain.ts holds a local copy used by the in-repo bundled-execution test.
  • Remove the broken tests/bundled.test.ts from the resolver and workflow templates along with the bundled vitest project and test:bundled / test:bundled:prepare scripts. These tests were not run in CI and had drifted out of sync with the SDK, producing failures on a fresh scaffold.

Related Issues

- Rewrite testing.md into a Unit/E2E two-layer model with working examples
  for resolvers (simple, TailorDB mocks, DI, wait-point resume) and workflow
  jobs (simple, trigger mocks, wait-point mocks, full-workflow integration)
- Deprecate `createImportMain` from `@tailor-platform/sdk/test` and copy it
  into example/tests/ for the local bundled-execution test
- Drop `tests/bundled.test.ts`, the `bundled` vitest project, and the
  `test:bundled` / `test:bundled:prepare` scripts from the resolver and
  workflow templates (closes tailor-inc/platform-planning#1136)
@changeset-bot

changeset-bot Bot commented Apr 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 534b6e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@tailor-platform/sdk Patch
@tailor-platform/create-sdk Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions

github-actions Bot commented Apr 26, 2026

Copy link
Copy Markdown

⚡ pkg.pr.new

@tailor-platform/sdk

pnpm add https://pkg.pr.new/@tailor-platform/sdk@534b6e0
pnpm dlx https://pkg.pr.new/@tailor-platform/sdk@534b6e0 --help

@tailor-platform/create-sdk

pnpm add https://pkg.pr.new/@tailor-platform/create-sdk@534b6e0
pnpm dlx https://pkg.pr.new/@tailor-platform/create-sdk@534b6e0 my-app

commit: 534b6e0

@github-actions

This comment has been minimized.

- Rework testing.md introduction: capability statement first, surface the
  unit-test entrypoints (`resolver.body`, `workflowJob.body`/`.trigger`,
  `executor.operation.body`) and helpers up front, shrink vitest.config.ts
  to the minimum, and demote the template pitch to a short note
- Add a `notifyUserCreated` function executor and its unit test to the
  resolver template, plus the `executor:` entry in tailor.config.ts so
  it is picked up by `tailor-sdk apply`
- Document Testing Executors in the guide between resolvers and workflow
  jobs, anchored on `executor.operation.body(args)` and noting that
  GraphQL/webhook/workflow operation kinds have no user-authored body
  to test
@github-actions

This comment has been minimized.

The previous commit added a notifyUserCreated executor to the resolver
template; revert that and put the executor test in the dedicated
executor template, which already ships a full set of executors and a
shared DB helper.

- Revert the new files and the executor: entry under the resolver template
- Add onUserCreated.test.ts to the executor template, spying on the
  shared createAuditLog helper to keep the test focused on the
  executor's argument forwarding
- Update testing.md to reference all three starter templates (resolver,
  executor, workflow) and base the Testing Executors example on the
  actual onUserCreated executor
@github-actions

This comment has been minimized.

The bash block alone is enough to convey that unit and e2e are separate
projects; the config snippet is implementation detail readers can find
in the templates.
@github-actions

This comment has been minimized.

Drop the bash snippet showing pnpm test:unit / pnpm test:e2e — it was
mechanical setup detail. Replace it with a short paragraph on choosing
between layers (speed and feedback-loop ergonomics for unit, integration
fidelity for E2E) so the intro answers a reader question instead of
repeating template scripts.
@github-actions

This comment has been minimized.

"in milliseconds" overcommits — wall time depends on the project. "Run
fast" conveys the same point without making a claim that won't always
hold.
@github-actions

This comment has been minimized.

# Conflicts:
#	example/tests/bundled_execution.test.ts
#	packages/create-sdk/templates/resolver/tests/bundled.test.ts
#	packages/create-sdk/templates/workflow/tests/bundled.test.ts
@github-actions

Copy link
Copy Markdown

Code Metrics Report (packages/sdk)

main (55e81e6) #1063 (647cdae) +/-
Coverage 59.4% 59.4% 0.0%
Code to Test Ratio 1:0.4 1:0.4 0.0
Details
  |                    | main (55e81e6) | #1063 (647cdae) | +/-  |
  |--------------------|----------------|-----------------|------|
  | Coverage           |          59.4% |           59.4% | 0.0% |
  |   Files            |            351 |             351 |    0 |
  |   Lines            |          11938 |           11938 |    0 |
  |   Covered          |           7092 |            7092 |    0 |
  | Code to Test Ratio |          1:0.4 |           1:0.4 |  0.0 |
  |   Code             |          78060 |           78060 |    0 |
  |   Test             |          31657 |           31657 |    0 |

Code coverage of files in pull request scope (57.1% → 57.1%)

Files Coverage +/- Status
packages/sdk/src/utils/test/mock.ts 57.1% 0.0% modified

SDK Configure Bundle Size

main (55e81e6) #1063 (647cdae) +/-
configure-index-size 17.17KB 17.17KB 0KB
dependency-chunks-size 33.25KB 33.25KB 0KB
total-bundle-size 50.42KB 50.42KB 0KB

Runtime Performance

main (55e81e6) #1063 (647cdae) +/-
Generate Median 2,395ms 2,230ms -165ms
Generate Max 2,431ms 2,402ms -29ms
Apply Build Median 2,455ms 2,202ms -253ms
Apply Build Max 2,478ms 2,252ms -226ms

Type Performance (instantiations)

main (55e81e6) #1063 (647cdae) +/-
tailordb-basic 35,130 35,130 0
tailordb-optional 3,841 3,841 0
tailordb-relation 7,428 7,428 0
tailordb-validate 2,566 2,566 0
tailordb-hooks 5,767 5,767 0
tailordb-object 12,136 12,136 0
tailordb-enum 2,462 2,462 0
resolver-basic 9,424 9,424 0
resolver-nested 26,111 26,111 0
resolver-array 18,187 18,187 0
executor-schedule 4,234 4,234 0
executor-webhook 873 873 0
executor-record 8,166 8,166 0
executor-resolver 4,369 4,369 0
executor-operation-function 869 869 0
executor-operation-gql 869 869 0
executor-operation-webhook 888 888 0
executor-operation-workflow 1,714 1,714 0

Reported by octocov

@toiroakr

Copy link
Copy Markdown
Contributor Author

Merged into #864

@toiroakr toiroakr closed this Apr 28, 2026
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