LemonCore.Testing.Helpers (lemon_core v0.1.0)

View Source

Helper functions for tests.

Summary

Functions

Clears all entries from a Store table.

Sets up a mock HOME directory for config tests. Returns the path to the mock home directory.

Generates a random master key for secrets testing.

Creates a temporary directory inside the harness temp dir. Returns the directory path.

Creates a temporary file with the given content. Returns the file path.

Generates a unique run ID for test isolation.

Generates a unique scope for test isolation.

Generates a unique session key for test isolation.

Generates a unique token for test isolation.

Waits for a process to be alive, with timeout.

Functions

clear_store_table(table)

Clears all entries from a Store table.

mock_home!(harness)

Sets up a mock HOME directory for config tests. Returns the path to the mock home directory.

random_master_key()

Generates a random master key for secrets testing.

temp_dir!(harness, name)

Creates a temporary directory inside the harness temp dir. Returns the directory path.

temp_file!(harness, filename, content)

Creates a temporary file with the given content. Returns the file path.

unique_run_id(prefix \\ "run")

Generates a unique run ID for test isolation.

unique_scope(prefix \\ :test)

Generates a unique scope for test isolation.

unique_session_key(prefix \\ "test")

Generates a unique session key for test isolation.

unique_token()

Generates a unique token for test isolation.

wait_for_process_alive(pid, timeout_ms \\ 1000)

Waits for a process to be alive, with timeout.