test: tighten unit test assertions across cli, sdk, and mcp#419
Merged
Conversation
Resolves High and Medium findings from the test-quality audit. No source code
changes — only test files. Baselines preserved or improved:
b2c-cli: 1218 → 1224 passing
b2c-tooling-sdk: 1722 → 1717 passing (0 pending; -13 tautological smokes,
+2 substantive tests, +6 previously
silently-skipped tests now run)
b2c-dx-mcp: 720 → 720 passing
Highlights:
- Removed mock theater: webdav `buildPath` SUT-stubs, openapi-fetch passthrough
comparisons, and "client creation" `to.exist` smokes that TypeScript already
proved.
- SCAPI command tests for "displays/logs in non-JSON mode" now capture stdout
and assert on rendered content; renderer is no longer stubbed.
- Replication 422/409 errors, sites "no sites" copy, content/validate real-
validator path, job `--show-log` invocation are now actually verified.
- e2e tests: replaced `oneOf([0,1])` and conditional-assertion patterns with
deterministic asserts; code-lifecycle delete captures version id before
clearing; sandbox delete follows up with a `get` 404 check; AM error tests
match real SUT messages; dead `hasProject` skip gate removed.
- SDK pagination tests either iterate properly or are renamed to match what
they actually verify; `oauth-jwt`, `auth/middleware`, watcher `stop()`,
base-command telemetry-skip, and plugin loader tests now assert on
observable behavior rather than `to.not.throw`.
- `MobifySource` tests use proper DI in place of `Object.defineProperty(os,
'homedir')` skip-on-fail; logs integration `beforeEach` fails loudly under
`process.env.CI`.
- MCP `addTool` registration tests intercept `registerTool` and invoke wrapped
handlers; site-theming filter test verifies the asked question is excluded;
page-designer-decorator regex tightened to deterministic strings; services
tests assert OAuth wiring and base URLs.
…ration The repo's CI does not provision a live B2C instance — the logs integration suite is genuinely opt-in and skipping is the correct behavior when the prerequisite is unavailable. Reverts the over-zealous "fail loud under CI" change introduced earlier in this PR.
patricksullivansf
approved these changes
May 12, 2026
Contributor
patricksullivansf
left a comment
There was a problem hiding this comment.
only reviewed mcp changes, but overall looks much better. thanks
Per @patricksullivansf review: the safeParse / isOptional / enum-value checks were testing Zod itself, not the tool's contract. Keep field-presence assertion only.
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
Resolves the High and Medium findings from the recent unit-test quality audit (
PLAN_unit_test_fixup.md). Test-only changes — nothing under anysrc/directory was touched.Test counts
The SDK net-delta of -5 is +2 substantive tests and +6 previously silently-skipped tests now running, minus 13 tautological smoke tests removed (TypeScript already proved their assertions).
What changed
buildPathSUT-stubs gone (now observed at the SDK seam); openapi-fetch passthrough tests now assert onAuthorizationheaders, query encoding, and field-level transforms instead of comparing canned data to itself.log.called.content/validatereal-validator path tested, job--show-loginvocation actually asserted, watcherstop()verifies subsequent file changes are ignored.oneOf([0,1])and conditional asserts with deterministic checks;code-lifecyclecaptures the deleted version id before clearing;sandbox-lifecycledelete follows up with a 404 check; AM error tests match real SUT messages; deadhasProject = trueskip gate removed.MobifySourcetests use proper DI in place ofObject.defineProperty(os, 'homedir')skip-on-fail; logs integrationbeforeEachfails loudly underprocess.env.CI.addTooltests interceptregisterTooland invoke wrapped handlers; site-theming filter verifies the asked question is excluded; page-designer-decorator regex tightened;servicestests assert OAuth wiring and base URLs.Test plan
pnpm --filter @salesforce/b2c-cli run test:agent— 1224 passingpnpm --filter @salesforce/b2c-tooling-sdk run test:agent— 1717 passing, 0 pendingpnpm --filter @salesforce/b2c-dx-mcp run test:agent— 720 passingpnpm run lint:agent— cleanpnpm run typecheck:agent— clean