testing-patterns-integration

testing-patterns-integration is a cursor rule for Cursor from lambda-curry/medusa2-starter. It costs 1,184 tokens per session, scanned A, original, MIT.

A set of integration testing rules for Medusa applications. Integration tests check how parts work together, such as API routes, databases, workflows, and external services.

In plain words
What is it for?
Use it to test API routes, database interactions, workflows, and realistic scenarios with controlled setup and cleanup.
Why use it?
It helps reveal connection and data-flow problems that isolated unit tests cannot detect.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to test API routes, database interactions, workflows, and realistic scenarios with controlled setup and cleanup.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/lambda-curry/medusa2-starter/testing-patterns-integration
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/lambda-curry/medusa2-starter

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for testing-patterns-integration

README.md
[![agentmods](https://agentmods.dev/badge/rules/lambda-curry/medusa2-starter/testing-patterns-integration/github.svg)](https://agentmods.dev/rules/lambda-curry/medusa2-starter/testing-patterns-integration)
Your own site
<a href="https://agentmods.dev/rules/lambda-curry/medusa2-starter/testing-patterns-integration"><img src="https://agentmods.dev/badge/rules/lambda-curry/medusa2-starter/testing-patterns-integration/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for testing-patterns-integration

Your own site · 80×15
<a href="https://agentmods.dev/rules/lambda-curry/medusa2-starter/testing-patterns-integration"><img src="https://agentmods.dev/badge/rules/lambda-curry/medusa2-starter/testing-patterns-integration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,184 This file is loaded in full into every session.
When invoked 1,184 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01184 $0.01184
Opus 5.5 $0.00474 $0.00474
Sonnet 5.5 $0.00237 $0.00237
Haiku 4.5 $0.00118 $0.00118

Measured 15d ago against content hash 3f8c744178fb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

testing-patterns-integration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 15d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/testing-patterns-integration.mdc · 185 lines

How it starts

The opening of the file, as written. The whole thing — 185 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Integration Testing Patterns for Medusa Applications

You are an expert in integration testing TypeScript applications, focusing on testing how different parts of the system work together in Medusa and React applications.

Core Testing Principles

  • Write tests that verify interactions between different system components
  • Test real integrations with databases, APIs, and external services
  • Use descriptive test names that explain the integration being tested
  • Arrange, Act, Assert (AAA) pattern for test structure
  • Test realistic scenarios and data flows
  • Use proper test data setup and cleanup
  • Ensure tests are isolated and can run independently

Integration Testing

API Route Testing

// api/__tests__/products.test.ts
import { createMedusaContainer } from "@medusajs/framework/utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"

medusaIntegrationTestRunner({
  testSuite: ({ getContainer, api }) => {
    describe("Products API", () => {
      let container: MedusaContainer

      beforeEach(() => {
        container = getContainer()
      })

      describe("GET /admin/products", () => {
        it("should return list of products", async () => {
          // Arrange - create test data
          const productService = container.resolve("productService")
          await productService.create({
            title: "Test Product",
            handle: "test-product",
          })

          // Act
          const response = await api.get("/admin/products")

          // Assert
          expect(response.status).toBe(200)
          expect(response.data.products).toHaveLength(1)
          expect(response.data.products[0].title).toBe("Test Product")
        })

        it("should filter products by title", async () => {
          // Arrange
          const productService = container.resolve("productService")
          await productService.create({
            title: "Product A",
            handle: "product-a",
          })
          await productService.create({
            title: "Product B",
            handle: "product-b",
          })

          // Act
          const response = await api.get("/admin/products?q=Product A")

          // Assert
          expect(response.status).toBe(200)
          expect(response.data.products).toHaveLength(1)
          expect(response.data.products[0].title).toBe("Product A")
        })
      })

      describe("POST /admin/products", () => {
        it("should create a new product", async () => {
          // Arrange
          const productData = {
            title: "New Product",
            handle: "new-product",
            description: "A new product",
          }

          // Act
          const response = await api.post("/admin/products", productData)

          // Assert
          expect(response.status).toBe(201)
          expect(response.data.product.title).toBe(productData.title)
          expect(response.data.product.handle).toBe(productData.handle)
        })

        it("should return validation error for invalid data", async () => {
          // Arrange
          const invalidData = {
            title: "", // Empty title should fail validation
          }

          // Act
          const response = await api.post("/admin/products", invalidData)

          // Assert
          expect(response.status).toBe(400)
          expect(response.data.errors).toBeDefined()
        })
      })
    })
  },
})

Read the full file on GitHub · 185 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 15d ago First seen · 185 lines · 1,184 tokens per session scan A 3f8c744178fb

Subscribe to this mod's changes

testing-patterns-integration is a cursor rule published in the GitHub repository lambda-curry/medusa2-starter (164 stars, last pushed 17d ago), licensed MIT. It adds 1,184 tokens to every session, about $0.0047 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-15.

Related

testing-patterns-integration compared with cursor rules from other repositories

testing-patterns-integration next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
testing-patterns-integrationlambda-curry/medusa2-starterCursor rule16417d agoMITA1,184Cursor
djangosanjeed5/awesome-cursor-rules-mdcCursor rule3.6k7d agoCC0-1.0A2,043Cursor
api-property-optionality-hygienenovuhq/novuCursor rule40ktodaynoneA0Cursor
pythonPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A734Cursor
cursormrwogu/promptscriptCursor rule3247d agoMITA53Cursor
gosupertokens/create-supertokens-appCursor rule243d agoApache-2.0A0Cursor
ehs-ims-conventionsSafetyMP/Autonomous-EHS-ManagementCursor rule9yesterdayApache-2.0A722Cursor