Help us shape the future of Go! Take the 2026 Go Developer Survey

fake

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package fake provides an in-process tracker.Tracker for tests. It registers itself under type "fake" so close_e2e_test.go can wire it through config.IssueTrackerConfig like a real adapter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New is the tracker.Register factory. cfg is ignored — tests configure the returned *Tracker directly via field access.

Types

type Tracker

type Tracker struct {
	Issues          []tracker.Issue
	Statuses        []string
	RecordedUpdates []Update

	// Closed[id] == true → IsIssueClosed returns (true, nil) for id.
	// Default zero-value (absent or false) → IsIssueClosed returns (false, nil).
	Closed map[string]bool
	// Unknown[id] == true → IsIssueClosed returns (false, tracker.ErrIssueNotFound).
	Unknown map[string]bool
	// Errors[id] != nil → IsIssueClosed returns (false, Errors[id]) — for transport-error scenarios.
	Errors map[string]error
	// contains filtered or unexported fields
}

Tracker is the exposed concrete type so tests can read RecordedUpdates after Close() returns. Construct via New() to satisfy the registry signature.

func (*Tracker) IsIssueClosed added in v0.10.0

func (t *Tracker) IsIssueClosed(_ context.Context, issueID string) (bool, error)

IsIssueClosed consults Closed / Unknown / Errors in that priority order.

func (*Tracker) ListIssues

func (t *Tracker) ListIssues(_ context.Context) ([]tracker.Issue, error)

ListIssues returns a snapshot of the configured issues.

func (*Tracker) ListStatuses

func (t *Tracker) ListStatuses(_ context.Context) ([]string, error)

ListStatuses returns a snapshot of the configured status names.

func (*Tracker) UpdateIssueStatus

func (t *Tracker) UpdateIssueStatus(_ context.Context, issueID, statusName string) error

UpdateIssueStatus records the call so tests can assert on it.

type Update

type Update struct {
	IssueID    string
	StatusName string
}

Update captures one UpdateIssueStatus call.

Jump to

Keyboard shortcuts

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