providertest

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package providertest provides conformance tests for CallSystem provider implementations.

Provider implementations can use this package to verify they correctly implement the callsystem.CallSystem interface with consistent behavior.

Basic usage:

func TestConformance(t *testing.T) {
    p, err := New(WithAccountSID(sid), WithAuthToken(token), WithPhoneNumber(phone))
    if err != nil {
        t.Fatal(err)
    }

    providertest.RunAll(t, providertest.Config{
        Provider:        p,
        SkipIntegration: phone == "",
        TestPhoneNumber: phone,
        TestFromNumber:  phone,
    })
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunAll

func RunAll(t *testing.T, cfg Config)

RunAll runs all conformance tests for a CallSystem provider.

func RunBehaviorTests

func RunBehaviorTests(t *testing.T, cfg Config)

RunBehaviorTests runs only behavioral contract tests.

func RunIntegrationTests

func RunIntegrationTests(t *testing.T, cfg Config)

RunIntegrationTests runs only integration tests (requires API credentials).

func RunInterfaceTests

func RunInterfaceTests(t *testing.T, cfg Config)

RunInterfaceTests runs only interface compliance tests. These tests verify the provider correctly implements the interface contract and do not require API credentials.

Types

type Config

type Config struct {
	// Provider is the CallSystem provider implementation to test.
	Provider callsystem.CallSystem

	// SkipIntegration skips tests that require real API calls.
	SkipIntegration bool

	// TestPhoneNumber is the number to call for integration tests (E.164 format).
	// Required if SkipIntegration is false.
	TestPhoneNumber string

	// TestFromNumber is the caller ID for outbound calls (E.164 format).
	// Required if SkipIntegration is false.
	TestFromNumber string

	// Timeout for individual test operations.
	// Defaults to 30 seconds if zero.
	Timeout time.Duration
}

Config configures the callsystem conformance test suite.

Jump to

Keyboard shortcuts

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