moduleutil

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package moduleutil provides module-specific test helpers for the oCMS project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertMigrations

func AssertMigrations(t *testing.T, migrations []module.Migration, expectedCount int)

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

func AssertTableNotExists(t *testing.T, db *sql.DB, tableName string)

AssertTableNotExists verifies that a table does not exist in the database. Useful for testing migration rollbacks.

func RunMigrations

func RunMigrations(t *testing.T, db *sql.DB, migrations []module.Migration)

RunMigrations runs all migrations up for the given module.

func RunMigrationsDown

func RunMigrationsDown(t *testing.T, db *sql.DB, migrations []module.Migration)

RunMigrationsDown rolls back all migrations for the given module.

func TestModuleContext

func TestModuleContext(t *testing.T, db *sql.DB) (*module.Context, *module.HookRegistry)

TestModuleContext creates a module.Context for testing. Returns the context and the hooks registry for verifying hook behavior.

func TestModuleContextWithStore

func TestModuleContextWithStore(t *testing.T, db *sql.DB) (*module.Context, *module.HookRegistry)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL