Documentation
¶
Overview ¶
Package moduleutil provides module-specific test helpers for the oCMS project.
Index ¶
- func AssertMigrations(t *testing.T, migrations []module.Migration, expectedCount int)
- func AssertTableNotExists(t *testing.T, db *sql.DB, tableName string)
- func RunMigrations(t *testing.T, db *sql.DB, migrations []module.Migration)
- func RunMigrationsDown(t *testing.T, db *sql.DB, migrations []module.Migration)
- func TestModuleContext(t *testing.T, db *sql.DB) (*module.Context, *module.HookRegistry)
- func TestModuleContextWithStore(t *testing.T, db *sql.DB) (*module.Context, *module.HookRegistry)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertMigrations ¶
AssertMigrations verifies that migrations have the expected count and valid structure. Checks that the first migration has version 1 and all migrations have descriptions.
func AssertTableNotExists ¶
AssertTableNotExists verifies that a table does not exist in the database. Useful for testing migration rollbacks.
func RunMigrations ¶
RunMigrations runs all migrations up for the given module.
func RunMigrationsDown ¶
RunMigrationsDown rolls back all migrations for the given module.
func TestModuleContext ¶
TestModuleContext creates a module.Context for testing. Returns the context and the hooks registry for verifying hook behavior.
func TestModuleContextWithStore ¶
TestModuleContextWithStore creates a module.Context with a store.Queries instance. Useful for modules that require Store field to be set.
Types ¶
This section is empty.