🧪 add unit test for iqraGraph#4
Conversation
This commit adds a new unit test for the `iqraGraph` exported from `lib/iqra/orchestrator.ts`. The test covers: - Verification that the graph is defined. - Processing of a message through the 'agent' node. - Assertions on the message state and response content. Mocks are used for LangChain models to ensure isolation and prevent network calls. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Moeabdelaziz007
left a comment
There was a problem hiding this comment.
❌ REJECTED: Destructive deletions detected.
📝 WalkthroughWalkthroughA new Vitest unit test suite validates ChangesiqraGraph Unit Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/unit/orchestrator.test.ts`:
- Line 54: The test assertion expecting an exact message count
(expect(result.messages.length).toBe(2)) is brittle; change it to assert a
minimum or check presence of required messages instead—e.g., replace with
expect(result.messages.length).toBeGreaterThanOrEqual(2) or assert that
result.messages contains the initial user message and an agent response by
checking message types/contents (inspect result.messages array entries) so the
test tolerates extra system/tool messages while still verifying the core
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 0c289f88-b38d-4d51-b29f-4ff02594e5c0
📒 Files selected for processing (1)
tests/unit/orchestrator.test.ts
|
|
||
| // Assertions | ||
| expect(result.messages).toBeDefined(); | ||
| expect(result.messages.length).toBe(2); // Initial user message + Agent response |
There was a problem hiding this comment.
Make the message-count assertion less brittle.
On Line 54, asserting an exact count of 2 can fail on valid graph changes (e.g., extra system/tool messages) even when behavior is correct.
Suggested patch
- expect(result.messages.length).toBe(2); // Initial user message + Agent response
+ expect(result.messages.length).toBeGreaterThanOrEqual(2); // Keep test resilient to extra orchestration messages📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| expect(result.messages.length).toBe(2); // Initial user message + Agent response | |
| expect(result.messages.length).toBeGreaterThanOrEqual(2); // Keep test resilient to extra orchestration messages |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/unit/orchestrator.test.ts` at line 54, The test assertion expecting an
exact message count (expect(result.messages.length).toBe(2)) is brittle; change
it to assert a minimum or check presence of required messages instead—e.g.,
replace with expect(result.messages.length).toBeGreaterThanOrEqual(2) or assert
that result.messages contains the initial user message and an agent response by
checking message types/contents (inspect result.messages array entries) so the
test tolerates extra system/tool messages while still verifying the core
behavior.
…#95) Wraps the existing SkillLoader (08-cognitive/skills/loader.ts) with an Ed25519 verification + TTL cache + policy layer. L2 reads skills from L3 (aix-agent-skills) as data; no code dependency. Signing protocol v1: - skills.json: Ed25519 over SHA-256 of JCS-canonical bytes - skills/<name>.md: Ed25519 over SHA-256 of raw UTF-8 bytes - sig files: detached .sig with base64url-encoded 64-byte sig Policy: off | permissive (default) | strict. Env vars: IQRA_MARKETPLACE_PUBKEY, IQRA_MARKETPLACE_POLICY, IQRA_MARKETPLACE_CACHE_TTL_MS. Tests are real e2e (No Mocks per IQRA_SUPREME): real Ed25519 keypairs, real SHA-256 digests, real on-disk fixtures under os.tmpdir(). 15/15 tests passing. Pre-existing tsc baseline (1 error in 13-utils personas.ts) unaffected. Contract documented in docs/L2_L3_INTEGRATION.md. Closes part of #71 (Hygiene Pass PR #4). Co-authored-by: Mohamed Abdelaziz <mabdela1@students.kennesaw.edu>
The testing gap addressed was the lack of unit tests for the public
iqraGraphAPI inlib/iqra/orchestrator.ts.I implemented a new test file
tests/unit/orchestrator.test.tsthat mocks external LLM providers and internal dependencies.The test verifies that the graph correctly handles user input and produces the expected response state.
This increases the reliability of the orchestration layer.
PR created automatically by Jules for task 15171371017903317709 started by @Moeabdelaziz007
Summary by CodeRabbit