Expand description
Server function testing utilities. Server function testing utilities.
This module provides comprehensive testing utilities for server functions, including context management, authentication mocking, and assertions.
§Features
- Enhanced Test Context: DI-based test context with authentication support
- Mock HTTP: Request/response mocking for server function testing
- Authentication Mocking: Test user and session simulation
- Assertions: Server function result assertions
- Transaction Management: Database transaction utilities for test isolation
Modules§
- assert_
permissions - Test helper for permission assertions.
- assert_
status - Assertion module for common HTTP status code checks.
- utils
- Test database utilities for common operations.
Macros§
- server_
fn_ test_ cases - Macro for creating server function test cases.
Structs§
- Cleanup
Guard - Guard that ensures cleanup runs at the end of a test.
- Cookie
Options - Cookie options for Set-Cookie header.
- Expected
Result - Result builder for testing server function responses.
- Mock
Http Request - Mock HTTP request for testing server functions.
- Mock
Http Response - Mock HTTP response for testing.
- Mock
Session - A mock session for testing session-based functionality.
- Response
Assertion - Response assertion builder for server functions that return HTTP-like responses.
- Server
FnTest Context - Enhanced test context builder for server function testing.
- Server
FnTest Env - The built test environment containing all test state.
- Test
Data Seeder - Helper for seeding test data.
- Test
Database Config - Configuration for test database behavior.
- Test
Savepoint - Wrapper for managing savepoints within a test.
- Test
Token Claims - Token claims for JWT testing.
- Test
Transaction - A test transaction that automatically rolls back on drop.
- Test
User - A test user for simulating authentication in tests.
Enums§
- Transaction
Mode - Transaction mode for test database operations.
Traits§
- HasStatus
Code - Trait for types that can provide a status code.
- Server
FnError Assertions - Extension trait for error assertions.
- Server
FnResult Assertions - Extension trait for asserting server function results.
- Test
Connection Ext - Trait for types that can be used as test transaction connections.
Functions§
- assert_
server_ fn_ error - Assert that a server function returns an error.
- assert_
server_ fn_ error_ contains - Assert that a server function error contains the specified message.
- assert_
server_ fn_ returns - Assert that a server function returns a specific value.
- assert_
validation_ error - Assert that a validation error occurred for a specific field.
- assert_
validation_ errors - Assert multiple validation errors occurred for the specified fields.