Cursor rule
.cursor/rules/testing-patterns.mdcComprehensive testing patterns for React Testing Library and Go testing in POS System
Cursor rules
Quality
74/100
Scores the file, not the repository.Length
2,623 words
52 headings · 19 code blocksRepository
118
— · pushed 339 days agoLast changed
3 days ago
First indexed 3 days ago.123456# 🧪 Testing Patterns & Best Practices78## 🎯 Testing Philosophy910### Testing Pyramid for POS System11```12 E2E Tests (Few)13 ↑ Full user workflows14 ↑ Critical business flows1516 Integration Tests (Some)17 ↑ API + Database interactions18 ↑ Component + API integration1920 Unit Tests (Many)21 ↑ Individual functions22 ↑ Component behavior23 ↑ Business logic validation24```2526### Test Coverage Targets27- **Unit Tests:** 80%+ coverage for business logic28- **Integration Tests:** All API endpoints with database29- **E2E Tests:** Core user journeys (login → order → payment → kitchen)3031## ⚛️ Frontend Testing Patterns (React Testing Library)3233### Component Testing Setup34```typescript35// test-utils.tsx - Custom testing utilities36import { render, RenderOptions } from '@testing-library/react'37import { QueryClient, QueryClientProvider } from '@tanstack/react-query'38import { ReactElement } from 'react'39import { BrowserRouter } from '@tanstack/react-router'4041// Create a test query client with no retries42const createTestQueryClient = () => new QueryClient({43 defaultOptions: {44 queries: {45 retry: false, // Don't retry on test failures46 gcTime: Infinity, // Keep data in cache47 },48 mutations: {49 retry: false,50 },51 },52})5354interface CustomRenderOptions extends Omit<RenderOptions, 'wrapper'> {55 queryClient?: QueryClient56 initialEntries?: string[]57}5859// Custom render with providers60export const renderWithProviders = (61 ui: ReactElement,62 {63 queryClient = createTestQueryClient(),64 initialEntries = ['/'],65 ...renderOptions66 }: CustomRenderOptions = {}67) => {68 const Wrapper = ({ children }: { children: React.ReactNode }) => (69 <QueryClientProvider client={queryClient}>70 <BrowserRouter initialEntries={initialEntries}>71 {children}72 </BrowserRouter>73 </QueryClientProvider>74 )7576 return { ...render(ui, { wrapper: Wrapper, ...renderOptions }), queryClient }77}7879// Re-export everything80export * from '@testing-library/react'81```8283### Component Testing Examples8485#### 1. Testing POS Product Card86```typescript87// ProductCard.test.tsx88import { screen, userEvent } from '@testing-library/react'89import { renderWithProviders } from '../test-utils'90import { ProductCard } from '@/components/pos/ProductCard'91import { Product } from '@/types'9293const mockProduct: Product = {94 id: '123',95 name: 'Cheeseburger',96 price: 12.99,97 category_id: 'burgers',98 is_available: true,99 description: 'Delicious beef burger',100 image_url: null,101}102103describe('ProductCard', () => {104 const mockOnSelect = jest.fn()105106 beforeEach(() => {107 mockOnSelect.mockClear()108 })109110 it('displays product information correctly', () => {111 renderWithProviders(112 <ProductCard113 product={mockProduct}114 onSelect={mockOnSelect}115 isSelected={false}116 />117 )118119 expect(screen.getByText('Cheeseburger')).toBeInTheDocument()120 expect(screen.getByText('$12.99')).toBeInTheDocument()121 expect(screen.getByText('Delicious beef burger')).toBeInTheDocument()122 })123124 it('calls onSelect when clicked', async () => {125 const user = userEvent.setup()126127 renderWithProviders(128 <ProductCard129 product={mockProduct}130 onSelect={mockOnSelect}131 isSelected={false}132 />133 )134135 await user.click(screen.getByText('Cheeseburger'))136 expect(mockOnSelect).toHaveBeenCalledWith(mockProduct)137 })138139 it('shows selected state correctly', () => {140 renderWithProviders(141 <ProductCard142 product={mockProduct}143 onSelect={mockOnSelect}144 isSelected={true}145 />146 )147148 const card = screen.getByRole('button')149 expect(card).toHaveClass('ring-2', 'ring-primary')150 })151152 it('disables unavailable products', () => {153 const unavailableProduct = { ...mockProduct, is_available: false }154155 renderWithProviders(156 <ProductCard157 product={unavailableProduct}158 onSelect={mockOnSelect}159 isSelected={false}160 />161 )162163 const card = screen.getByRole('button')164 expect(card).toBeDisabled()165 expect(screen.getByText('Unavailable')).toBeInTheDocument()166 })167})168```169170#### 2. Testing Forms with React Hook Form171```typescript172// OrderForm.test.tsx173import { screen, userEvent, waitFor } from '@testing-library/react'174import { renderWithProviders } from '../test-utils'175import { OrderForm } from '@/components/forms/OrderForm'176import { CreateOrderRequest } from '@/types'177178// Mock API client179jest.mock('@/api/client', () => ({180 createOrder: jest.fn(),181}))182183describe('OrderForm', () => {184 const mockOnSubmit = jest.fn()185 const mockOnCancel = jest.fn()186187 beforeEach(() => {188 mockOnSubmit.mockClear()189 mockOnCancel.mockClear()190 })191192 it('renders form fields correctly', () => {193 renderWithProviders(194 <OrderForm onSubmit={mockOnSubmit} onCancel={mockOnCancel} />195 )196197 expect(screen.getByLabelText(/order type/i)).toBeInTheDocument()198 expect(screen.getByLabelText(/customer name/i)).toBeInTheDocument()199 expect(screen.getByRole('button', { name: /create order/i })).toBeInTheDocument()200 expect(screen.getByRole('button', { name: /cancel/i })).toBeInTheDocument()201 })202203 it('validates required fields', async () => {204 const user = userEvent.setup()205206 renderWithProviders(207 <OrderForm onSubmit={mockOnSubmit} onCancel={mockOnCancel} />208 )209210 // Try to submit without selecting order type211 await user.click(screen.getByRole('button', { name: /create order/i }))212213 await waitFor(() => {214 expect(screen.getByText(/order type is required/i)).toBeInTheDocument()215 })216217 expect(mockOnSubmit).not.toHaveBeenCalled()218 })219220 it('submits valid form data', async () => {221 const user = userEvent.setup()222223 renderWithProviders(224 <OrderForm onSubmit={mockOnSubmit} onCancel={mockOnCancel} />225 )226227 // Fill out form228 await user.selectOptions(screen.getByLabelText(/order type/i), 'dine_in')229 await user.type(screen.getByLabelText(/customer name/i), 'John Doe')230231 // Submit232 await user.click(screen.getByRole('button', { name: /create order/i }))233234 await waitFor(() => {235 expect(mockOnSubmit).toHaveBeenCalledWith({236 order_type: 'dine_in',237 customer_name: 'John Doe',238 items: [],239 notes: '',240 })241 })242 })243})244```245246#### 3. Testing API Integration with MSW247```typescript248// api-integration.test.tsx249import { rest } from 'msw'250import { setupServer } from 'msw/node'251import { screen, userEvent, waitFor } from '@testing-library/react'252import { renderWithProviders } from '../test-utils'253import { ProductList } from '@/components/pos/ProductList'254255// Mock API server256const server = setupServer(257 rest.get('http://localhost:8080/api/v1/products', (req, res, ctx) => {258 return res(259 ctx.json({260 success: true,261 data: [262 { id: '1', name: 'Burger', price: 10.99, is_available: true },263 { id: '2', name: 'Pizza', price: 15.99, is_available: true },264 ]265 })266 )267 }),268269 rest.post('http://localhost:8080/api/v1/orders', (req, res, ctx) => {270 return res(271 ctx.json({272 success: true,273 data: { id: 'order-1', order_number: 'ORD-001' }274 })275 )276 })277)278279beforeAll(() => server.listen())280afterEach(() => server.resetHandlers())281afterAll(() => server.close())282283describe('ProductList Integration', () => {284 it('loads and displays products from API', async () => {285 renderWithProviders(<ProductList onProductSelect={jest.fn()} />)286287 // Wait for products to load288 await waitFor(() => {289 expect(screen.getByText('Burger')).toBeInTheDocument()290 expect(screen.getByText('Pizza')).toBeInTheDocument()291 })292 })293294 it('handles API errors gracefully', async () => {295 // Mock server error296 server.use(297 rest.get('http://localhost:8080/api/v1/products', (req, res, ctx) => {298 return res(ctx.status(500), ctx.json({ error: 'Server error' }))299 })300 )301302 renderWithProviders(<ProductList onProductSelect={jest.fn()} />)303304 await waitFor(() => {305 expect(screen.getByText(/failed to load products/i)).toBeInTheDocument()306 })307 })308})309```310311### Custom Hooks Testing312```typescript313// useCart.test.ts314import { renderHook, act } from '@testing-library/react'315import { useCart } from '@/hooks/useCart'316import { Product } from '@/types'317318const mockProduct: Product = {319 id: '1',320 name: 'Test Product',321 price: 10.00,322 category_id: 'test',323 is_available: true,324}325326describe('useCart', () => {327 it('adds items to cart correctly', () => {328 const { result } = renderHook(() => useCart())329330 act(() => {331 result.current.addItem(mockProduct, 2)332 })333334 expect(result.current.items).toHaveLength(1)335 expect(result.current.items[0]).toEqual({336 product: mockProduct,337 quantity: 2,338 subtotal: 20.00,339 })340 expect(result.current.total).toBe(20.00)341 })342343 it('updates item quantity correctly', () => {344 const { result } = renderHook(() => useCart())345346 act(() => {347 result.current.addItem(mockProduct, 1)348 result.current.updateQuantity(mockProduct.id, 3)349 })350351 expect(result.current.items[0].quantity).toBe(3)352 expect(result.current.total).toBe(30.00)353 })354355 it('removes items from cart', () => {356 const { result } = renderHook(() => useCart())357358 act(() => {359 result.current.addItem(mockProduct, 1)360 result.current.removeItem(mockProduct.id)361 })362363 expect(result.current.items).toHaveLength(0)364 expect(result.current.total).toBe(0)365 })366})367```368369## 🔧 Backend Testing Patterns (Go)370371### Test Structure and Setup372```go373// handlers_test.go374package handlers375376import (377 "bytes"378 "encoding/json"379 "net/http"380 "net/http/httptest"381 "testing"382383 "github.com/gin-gonic/gin"384 "github.com/stretchr/testify/assert"385 "github.com/stretchr/testify/require"386 "your-project/internal/models"387)388389// Setup test router with middleware390func setupTestRouter() *gin.Engine {391 gin.SetMode(gin.TestMode)392 router := gin.New()393394 // Add necessary middleware for tests395 router.Use(gin.Recovery())396397 return router398}399400// Helper to create authenticated request401func createAuthenticatedRequest(method, url string, body interface{}, userID, role string) *http.Request {402 var reqBody []byte403 if body != nil {404 reqBody, _ = json.Marshal(body)405 }406407 req := httptest.NewRequest(method, url, bytes.NewBuffer(reqBody))408 req.Header.Set("Content-Type", "application/json")409410 // Add auth context for testing411 req.Header.Set("X-User-ID", userID)412 req.Header.Set("X-User-Role", role)413414 return req415}416```417418### Testing HTTP Handlers419```go420// order_handler_test.go421func TestOrderHandler_CreateOrder(t *testing.T) {422 db := setupTestDB(t)423 defer teardownTestDB(t, db)424425 orderHandler := NewOrderHandler(db)426 router := setupTestRouter()427 router.POST("/orders", orderHandler.CreateOrder)428429 tests := []struct {430 name string431 request models.CreateOrderRequest432 userRole string433 expectedCode int434 expectError string435 }{436 {437 name: "valid dine-in order",438 request: models.CreateOrderRequest{439 OrderType: "dine_in",440 CustomerName: stringPtr("John Doe"),441 Items: []models.CreateOrderItem{442 {ProductID: "product-1", Quantity: 2},443 },444 },445 userRole: "server",446 expectedCode: http.StatusCreated,447 },448 {449 name: "empty order items",450 request: models.CreateOrderRequest{451 OrderType: "dine_in",452 Items: []models.CreateOrderItem{},453 },454 userRole: "server",455 expectedCode: http.StatusBadRequest,456 expectError: "empty_order",457 },458 {459 name: "invalid order type",460 request: models.CreateOrderRequest{461 OrderType: "invalid_type",462 Items: []models.CreateOrderItem{463 {ProductID: "product-1", Quantity: 1},464 },465 },466 userRole: "server",467 expectedCode: http.StatusBadRequest,468 expectError: "invalid_order_type",469 },470 }471472 for _, tt := range tests {473 t.Run(tt.name, func(t *testing.T) {474 req := createAuthenticatedRequest("POST", "/orders", tt.request, "user-1", tt.userRole)475 w := httptest.NewRecorder()476477 router.ServeHTTP(w, req)478479 assert.Equal(t, tt.expectedCode, w.Code)480481 var response models.APIResponse482 err := json.Unmarshal(w.Body.Bytes(), &response)483 require.NoError(t, err)484485 if tt.expectError != "" {486 assert.False(t, response.Success)487 assert.NotNil(t, response.Error)488 assert.Equal(t, tt.expectError, *response.Error)489 } else {490 assert.True(t, response.Success)491 assert.NotNil(t, response.Data)492 }493 })494 }495}496```497498### Database Integration Testing499```go500// database_test.go501func setupTestDB(t *testing.T) *sql.DB {502 db, err := sql.Open("postgres", "postgresql://test:test@localhost:5433/pos_test?sslmode=disable")503 require.NoError(t, err)504505 // Run migrations or seed test data506 seedTestData(t, db)507508 return db509}510511func teardownTestDB(t *testing.T, db *sql.DB) {512 // Clean up test data513 cleanupTestData(t, db)514 db.Close()515}516517func seedTestData(t *testing.T, db *sql.DB) {518 // Insert test products519 _, err := db.Exec(`520 INSERT INTO products (id, name, price, category_id, is_available)521 VALUES522 ('product-1', 'Test Burger', 10.99, 'category-1', true),523 ('product-2', 'Test Pizza', 15.99, 'category-1', true)524 `)525 require.NoError(t, err)526527 // Insert test users528 _, err = db.Exec(`529 INSERT INTO users (id, username, role, password_hash)530 VALUES531 ('user-1', 'testserver', 'server', '$2b$10$hash'),532 ('user-2', 'testadmin', 'admin', '$2b$10$hash')533 `)534 require.NoError(t, err)535}536537func cleanupTestData(t *testing.T, db *sql.DB) {538 tables := []string{"order_items", "orders", "products", "categories", "users"}539 for _, table := range tables {540 _, err := db.Exec(fmt.Sprintf("DELETE FROM %s", table))541 require.NoError(t, err)542 }543}544```545546### Testing Business Logic547```go548// order_service_test.go549func TestCalculateOrderTotal(t *testing.T) {550 tests := []struct {551 name string552 items []models.OrderItem553 expected float64554 }{555 {556 name: "single item",557 items: []models.OrderItem{558 {Price: 10.99, Quantity: 1},559 },560 expected: 10.99,561 },562 {563 name: "multiple items",564 items: []models.OrderItem{565 {Price: 10.99, Quantity: 2},566 {Price: 5.50, Quantity: 1},567 },568 expected: 27.48,569 },570 {571 name: "empty order",572 items: []models.OrderItem{},573 expected: 0.00,574 },575 }576577 for _, tt := range tests {578 t.Run(tt.name, func(t *testing.T) {579 total := calculateOrderTotal(tt.items)580 assert.Equal(t, tt.expected, total)581 })582 }583}584```585586## 🎭 E2E Testing Strategy587588### Critical User Journeys589```typescript590// e2e/order-flow.spec.ts591import { test, expect } from '@playwright/test'592593test.describe('Complete Order Flow', () => {594 test('admin can process full order lifecycle', async ({ page }) => {595 // Login as admin596 await page.goto('/login')597 await page.fill('[name="username"]', 'admin')598 await page.fill('[name="password"]', 'admin123')599 await page.click('button[type="submit"]')600601 // Navigate to server interface602 await page.click('text=Server Interface')603604 // Create order605 await page.click('text=Cheeseburger')606 await page.click('text=Add Fries')607 await page.click('button:has-text("Create Order")')608609 // Verify order created610 await expect(page.locator('text=Order Created')).toBeVisible()611612 // Switch to kitchen interface613 await page.click('text=Kitchen Display')614615 // Update order status616 await page.click('button:has-text("Start Preparing")')617 await page.click('button:has-text("Ready")')618619 // Switch to counter for payment620 await page.click('text=Counter/Checkout')621622 // Process payment623 await page.click('button:has-text("Cash")')624 await page.fill('[name="amount_received"]', '25.00')625 await page.click('button:has-text("Complete Payment")')626627 // Verify payment processed628 await expect(page.locator('text=Payment Complete')).toBeVisible()629 })630})631```632633## 🎯 Testing Best Practices634635### Do's ✅636- **Test behavior, not implementation** - Focus on what users see and do637- **Use meaningful test names** - Describe the behavior being tested638- **Follow AAA pattern** - Arrange, Act, Assert639- **Mock external dependencies** - Keep tests isolated and fast640- **Test error states** - Ensure graceful error handling641- **Use test data builders** - Create reusable test data factories642643### Don'ts ❌644- **Don't test implementation details** - Avoid testing internal component state645- **Don't create brittle selectors** - Prefer semantic queries over CSS selectors646- **Don't share state between tests** - Each test should be independent647- **Don't mock what you don't own** - Avoid mocking third-party libraries unnecessarily648- **Don't write tests without assertions** - Every test should verify something649650### Test Organization651```652src/653├── components/654│ ├── __tests__/ # Component tests655│ │ ├── ProductCard.test.tsx656│ │ └── OrderForm.test.tsx657│ └── ProductCard.tsx658├── hooks/659│ ├── __tests__/ # Hook tests660│ │ └── useCart.test.ts661│ └── useCart.ts662├── api/663│ ├── __tests__/ # API integration tests664│ │ └── client.test.ts665│ └── client.ts666└── __tests__/667 ├── test-utils.tsx # Test utilities668 └── setup.ts # Test setup669```670671## 🚀 Development Commands672673### Frontend Testing674```bash675# Run all tests676npm test677678# Run tests in watch mode679npm run test:watch680681# Run tests with coverage682npm run test:coverage683684# Run E2E tests685npm run test:e2e686```687688### Backend Testing689```bash690# Run all Go tests691go test ./...692693# Run tests with coverage694go test -coverprofile=coverage.out ./...695go tool cover -html=coverage.out696697# Run specific test698go test -run TestOrderHandler_CreateOrder ./internal/handlers699700# Run tests with verbose output701go test -v ./...702```703704### Integration Testing705```bash706# Start test database707make test-db708709# Run integration tests710make test-integration711712# Run full test suite713make test-all714```715716## 🛡️ Advanced QA Integration & Error Prevention717718### 1. Proactive Error Prevention Testing719```typescript720// ✅ ERROR PREVENTION: Business logic boundary testing721describe('Business Logic Boundary Tests', () => {722 describe('Order Value Boundaries', () => {723 const boundaryTestCases = [724 { value: 0, expected: 'reject', reason: 'zero_amount' },725 { value: 0.01, expected: 'accept', reason: 'minimum_valid' },726 { value: 999.99, expected: 'accept', reason: 'maximum_normal' },727 { value: 1000.00, expected: 'require_approval', reason: 'high_value_threshold' },728 { value: 10000.00, expected: 'reject', reason: 'exceeds_daily_limit' },729 { value: -1, expected: 'reject', reason: 'negative_amount' },730 { value: Number.MAX_VALUE, expected: 'reject', reason: 'overflow_protection' }731 ]732733 boundaryTestCases.forEach(({ value, expected, reason }) => {734 it(`should ${expected} order with value ${value} (${reason})`, async () => {735 const order = createMockOrder({ total_amount: value })736 const validator = new OrderValidator()737738 const result = await validator.validateOrderValue(order)739740 expect(result.decision).toBe(expected)741 expect(result.reason).toBe(reason)742 })743 })744 })745746 describe('Edge Case Scenarios', () => {747 it('should handle concurrent order modifications gracefully', async () => {748 const order = await createTestOrder()749750 // Simulate concurrent modifications751 const modifications = Array(10).fill(null).map((_, index) =>752 orderService.addItem(order.id, {753 product_id: `item-${index}`,754 quantity: 1755 })756 )757758 const results = await Promise.allSettled(modifications)759 const successful = results.filter(r => r.status === 'fulfilled')760 const failed = results.filter(r => r.status === 'rejected')761762 // Should handle gracefully without data corruption763 expect(successful.length + failed.length).toBe(10)764 expect(failed.every(f =>765 f.reason instanceof ConcurrencyError766 )).toBe(true)767 })768769 it('should handle network interruption during payment', async () => {770 const payment = createMockPayment({ amount: 25.99 })771772 // Mock network interruption773 jest.spyOn(paymentGateway, 'process')774 .mockRejectedValueOnce(new NetworkError('Connection timeout'))775 .mockResolvedValueOnce({ success: true, transaction_id: 'txn_123' })776777 const result = await paymentService.processWithRetry(payment)778779 expect(result.success).toBe(true)780 expect(result.retry_count).toBe(1)781 expect(result.error_recovery).toBe('automatic_retry')782 })783 })784})785786// Property-based testing for business rules787describe('Property-Based Business Logic Tests', () => {788 it('should maintain order total consistency', () => {789 fc.assert(fc.property(790 fc.array(fc.record({791 price: fc.float({ min: 0.01, max: 100 }),792 quantity: fc.integer({ min: 1, max: 10 })793 })),794 (items) => {795 const order = createOrderFromItems(items)796 const calculatedTotal = items.reduce(797 (sum, item) => sum + (item.price * item.quantity),798 0799 )800801 expect(order.total_amount).toBeCloseTo(calculatedTotal, 2)802 }803 ))804 })805806 it('should preserve business invariants across operations', () => {807 fc.assert(fc.property(808 fc.array(fc.oneof(809 fc.record({ type: 'add_item', ...itemGenerator }),810 fc.record({ type: 'remove_item', item_id: fc.string() }),811 fc.record({ type: 'update_quantity', item_id: fc.string(), quantity: fc.nat() })812 )),813 (operations) => {814 const order = createEmptyOrder()815816 operations.forEach(op => {817 try {818 orderService.applyOperation(order, op)819820 // Verify invariants after each operation821 expect(order.total_amount).toBeGreaterThanOrEqual(0)822 expect(order.items.every(item => item.quantity > 0)).toBe(true)823 expect(order.items.length).toBeLessThanOrEqual(MAX_ORDER_ITEMS)824 } catch (error) {825 // Operations can fail, but should fail gracefully826 expect(error).toBeInstanceOf(BusinessRuleError)827 }828 })829 }830 ))831 })832})833```834835### 2. Quality Gates Automation836```typescript837// ✅ AUTOMATION: Quality gates with business context838class QualityGatesAutomation {839 // Automated business logic validation840 static createBusinessLogicValidator(): BusinessLogicValidator {841 return {842 validateBusinessRules: async (changeset: CodeChangeset): Promise<ValidationResult> => {843 const violations: BusinessRuleViolation[] = []844845 // Check for business logic consistency846 const businessLogicFiles = changeset.files.filter(f =>847 f.path.includes('handlers') ||848 f.path.includes('services') ||849 f.path.includes('business-logic')850 )851852 for (const file of businessLogicFiles) {853 const analysis = await this.analyzeBusinessLogic(file)854855 if (analysis.hasInconsistentPricing) {856 violations.push({857 type: 'PRICING_CONSISTENCY',858 severity: 'high',859 file: file.path,860 message: 'Pricing calculation inconsistency detected',861 suggestion: 'Use centralized pricing service'862 })863 }864865 if (analysis.hasUnvalidatedUserInput) {866 violations.push({867 type: 'INPUT_VALIDATION',868 severity: 'critical',869 file: file.path,870 message: 'User input not properly validated',871 suggestion: 'Add input validation using business validation rules'872 })873 }874 }875876 return {877 passed: violations.length === 0,878 violations,879 businessImpact: this.assessBusinessImpact(violations)880 }881 },882883 validatePerformanceImpact: async (changeset: CodeChangeset): Promise<PerformanceImpact> => {884 const performanceAnalysis = await this.analyzePerformanceChanges(changeset)885886 return {887 databaseQueryImpact: performanceAnalysis.queryChanges,888 memoryImpact: performanceAnalysis.memoryChanges,889 bundleSizeImpact: performanceAnalysis.bundleChanges,890 businessCriticalPathsAffected: performanceAnalysis.criticalPaths,891 recommendations: this.generatePerformanceRecommendations(performanceAnalysis)892 }893 }894 }895 }896897 // Automated deployment quality gates898 static createDeploymentQualityGates(): DeploymentQualityGates {899 return {900 preDeploymentChecks: [901 {902 name: 'Business Logic Regression Tests',903 check: async () => {904 const regressionResults = await this.runBusinessRegressionTests()905 return {906 passed: regressionResults.allPassed,907 critical_failures: regressionResults.criticalFailures,908 business_impact: regressionResults.businessImpact909 }910 }911 },912 {913 name: 'Performance Validation',914 check: async () => {915 const performanceResults = await this.validateDeploymentPerformance()916 return {917 passed: performanceResults.meetsThresholds,918 response_times: performanceResults.responseTimes,919 resource_usage: performanceResults.resourceUsage920 }921 }922 }923 ],924925 postDeploymentVerification: [926 {927 name: 'Business Critical Flows',928 verify: async () => {929 const flowResults = await this.verifyBusinessCriticalFlows()930 return {931 order_creation: flowResults.orderCreation.success,932 payment_processing: flowResults.paymentProcessing.success,933 kitchen_workflow: flowResults.kitchenWorkflow.success,934 overall_health: flowResults.overallHealth935 }936 }937 }938 ]939 }940 }941}942```943944### Enhanced Testing Commands945946#### Advanced Frontend Testing947```bash948# Business logic validation949npm run test:business-logic950951# Performance regression tests952npm run test:performance953954# Quality gates validation955npm run test:quality-gates956957# Property-based testing958npm run test:property-based959960# Error boundary testing961npm run test:error-boundaries962```963964#### Advanced Backend Testing965```bash966# Business logic consistency tests967go test -run TestBusinessLogic ./...968969# Load and performance tests970go test -run TestLoad ./...971972# Integration tests with business scenarios973go test -tags=business-integration ./...974975# Boundary and edge case tests976go test -run TestBoundary ./...977```
Also in madebyaris/poinf-of-sales
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| madebyaris/poinf-of-sales.cursor/rules/admin-interface-patterns.mdc · 118 | Cursor rules | stylearchsecurityapi+2 | 62/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/api-patterns.mdc · 118 | Cursor rules | lint-formatstylesecuritydatabase+3 | 62/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/authentication-and-security-patterns.mdc · 118 | Cursor rules | setupteststylesecurity+4 | 81/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/backend-golang.mdc · 118 | Cursor rules | testlint-formatstylearch+5 | 69/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/business-logic-patterns.mdc · 118 | Cursor rules | teststyledatabaseperformance+1 | 50/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/database-patterns.mdc · 118 | Cursor rules | stylearchtypessecurity+2 | 62/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/development-workflow.mdc · 118 | Cursor rules | setupbuildteststyle+3 | 86/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/docker-deployment.mdc · 118 | Cursor rules | setupbuildteststyle+8 | 77/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/frontend-react.mdc · 118 | Cursor rules | buildtestlint-formatstyle+4 | 69/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/makefile-scripting.mdc · 118 | Cursor rules | setuplint-formatstylearch+2 | 81/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/performance-optimization-patterns.mdc · 118 | Cursor rules | buildteststyledatabase+3 | 66/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/project-architecture.mdc · 118 | Cursor rules | setupteststylearch+6 | 78/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/react-native-mobile-patterns.mdc · 118 | Cursor rules | buildstylearchui+2 | 74/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/role-based-access-patterns.mdc · 118 | Cursor rules | styletypessecuritydatabase+2 | 58/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/tech-debt-prevention.mdc · 118 | Cursor rules | styletesting-strategyui | 50/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/user-journey-optimization.mdc · 118 | Cursor rules | styleperformanceagent-behaviour | 50/100 | 3 days ago |
Diff against .cursor/rules/admin-interface-patterns.mdc Diff against .cursor/rules/api-patterns.mdc Diff against .cursor/rules/authentication-and-security-patterns.mdc Diff against .cursor/rules/backend-golang.mdc Diff against .cursor/rules/business-logic-patterns.mdc Diff against .cursor/rules/database-patterns.mdc Diff against .cursor/rules/development-workflow.mdc Diff against .cursor/rules/docker-deployment.mdc Diff against .cursor/rules/frontend-react.mdc Diff against .cursor/rules/makefile-scripting.mdc Diff against .cursor/rules/performance-optimization-patterns.mdc Diff against .cursor/rules/project-architecture.mdc Diff against .cursor/rules/react-native-mobile-patterns.mdc Diff against .cursor/rules/role-based-access-patterns.mdc Diff against .cursor/rules/tech-debt-prevention.mdc Diff against .cursor/rules/user-journey-optimization.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
