docs(testing): revamp testing guide and remove broken template tests#1063
Closed
toiroakr wants to merge 7 commits into
Closed
docs(testing): revamp testing guide and remove broken template tests#1063toiroakr wants to merge 7 commits into
toiroakr wants to merge 7 commits into
Conversation
- 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 detectedLatest commit: 534b6e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
⚡ pkg.pr.new@tailor-platform/sdk@tailor-platform/create-sdk
|
This comment has been minimized.
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
This comment has been minimized.
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
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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
Code Metrics Report (packages/sdk)
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%)
SDK Configure Bundle Size
Runtime Performance
Type Performance (instantiations)
Reported by octocov |
Contributor
Author
|
Merged into #864 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/sdk/docs/testing.mdinto 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 actualresolverandworkflowtemplates.createImportMainfrom@tailor-platform/sdk/testas@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 andexample/tests/createImportMain.tsholds a local copy used by the in-repo bundled-execution test.tests/bundled.test.tsfrom theresolverandworkflowtemplates along with thebundledvitest project andtest:bundled/test:bundled:preparescripts. These tests were not run in CI and had drifted out of sync with the SDK, producing failures on a fresh scaffold.Related Issues
discussion_r3138189537,pullrequestreview-4171063341)