Skip to content

Conversation

@yehorkardash
Copy link
Contributor

@yehorkardash yehorkardash commented Oct 30, 2025

Summary

This PR adds unit tests to the new Guardrails node

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/NODE-3797/write-tests-for-guardrail-node

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

…hub.com:n8n-io/n8n into node-3757-build-openai-inspired-guardrails-node
@n8n-assistant n8n-assistant bot added the n8n team Authored by the n8n team label Oct 30, 2025
@yehorkardash yehorkardash marked this pull request as ready for review October 30, 2025 15:02
@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 10 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/@n8n/nodes-langchain/nodes/Guardrails/test/helpers/model.test.ts">

<violation number="1" location="packages/@n8n/nodes-langchain/nodes/Guardrails/test/helpers/model.test.ts:105">
`runLLMValidation` now expects the input text followed by a config object, but the test still passes positional arguments. This will throw before the helper runs and makes the test fail.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

.mocked((await import('langchain/agents')).AgentExecutor)
.mockImplementation(() => mockAgentExecutor as unknown as AgentExecutor);

const result = await runLLMValidation(
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runLLMValidation now expects the input text followed by a config object, but the test still passes positional arguments. This will throw before the helper runs and makes the test fail.

Prompt for AI agents
Address the following comment on packages/@n8n/nodes-langchain/nodes/Guardrails/test/helpers/model.test.ts at line 105:

<comment>`runLLMValidation` now expects the input text followed by a config object, but the test still passes positional arguments. This will throw before the helper runs and makes the test fail.</comment>

<file context>
@@ -0,0 +1,151 @@
+				.mocked((await import(&#39;langchain/agents&#39;)).AgentExecutor)
+				.mockImplementation(() =&gt; mockAgentExecutor as unknown as AgentExecutor);
+
+			const result = await runLLMValidation(
+				&#39;test-guardrail&#39;,
+				mockModel,
</file context>
Fix with Cubic

@Joffcom Joffcom requested a review from ShireenMissi October 31, 2025 08:06
Copy link
Contributor

@ShireenMissi ShireenMissi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

@currents-bot
Copy link

currents-bot bot commented Oct 31, 2025

E2E Tests: n8n tests passed after 7m 45s

🟢 584 · 🔴 0 · ⚪️ 12 · 🟣 1

View Run Details

Run Details

  • Project: n8n

  • Groups: 2

  • Framework: Playwright

  • Run Status: Passed

  • Commit: 032834d

  • Spec files: 96

  • Overall tests: 596

  • Duration: 7m 45s

  • Parallelization: 8

Groups

GroupId Results Spec Files Progress
ui 🟢 529 · 🔴 0 · ⚪️ 12 89 / 89
ui:isolated 🟢 55 · 🔴 0 · ⚪️ 0 · 🟣 1 7 / 7


This message was posted automatically by currents.dev | Integration Settings

@ShireenMissi ShireenMissi merged commit 7e1f07d into master Oct 31, 2025
44 checks passed
@ShireenMissi ShireenMissi deleted the node-3797-write-tests-for-guardrail-node branch October 31, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants