fix(plugin): wire openclaw-agentweave-bridge tests and fix all 8 failures#161
Merged
fix(plugin): wire openclaw-agentweave-bridge tests and fix all 8 failures#161
Conversation
…ures
- Add vitest, typescript, @types/node devDeps + test script to package.json
- Add tsconfig.json and vitest.config.ts
- Fix NodeSDK mock: arrow function can't be used as constructor — use
vi.fn().mockImplementation(function() { return {...} }) instead
- Fix fire() helper: service.ts uses globalThis.__openclawDiagnosticEventsState
directly, not onDiagnosticEvent hook — dispatch through that state
- Fix config shape in makeCtx() to match service.ts nested read path
- Add SimpleSpanProcessor to sdk-trace-base mock (upstream switched from Batch)
- Add tool.loop handler to service.ts (missing case — test expected it)
- Add plugin-openclaw-bridge CI job to test.yml
Production code still writes these attributes; re-adds the coverage dropped during the test rewrite. Follow-up to PR #161 review. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Problem
The
plugins/openclaw-agentweave-bridgeplugin had 8 tests that were completely unrunnable and contained several bugs.Root causes
1. No test runner wired up
package.jsonhad notestscript, novitestdep, notsconfig.json, novitest.config.ts.2.
NodeSDKmocked with arrow functionvi.fn(() => ({...}))— arrow functions can't benew'd. CausedTypeError: is not a constructoron every test.3. Stale
fire()helperTests dispatched via
onDiagnosticEventhook, butservice.tsusesglobalThis.__openclawDiagnosticEventsStatedirectly.capturedListenerwas alwaysnull.4. Missing
tool.loophandlerservice.tshad nocase "tool.loop":— test expected atool.loop.detectedspan event.5. Plugin excluded from CI
.github/workflows/test.ymlonly ransdk/js,sdk/python,sdk/go.Changes
package.json— vitest + typescript devDeps, test scripttsconfig.json+vitest.config.ts— newsrc/service.ts— addtool.loopcasesrc/service.test.ts— fix mocks,fire(), config shape, assertions.github/workflows/test.yml— add plugin CI jobAll 8 tests pass.