Skip to content

testutils

Go
import "github.com/andreoliwa/logseq-doctor/internal/testutils"

Index

Variables

Go
var baselineTime = time.Date(2025, 4, 13, 3, 33, 0, 0, time.UTC) //nolint:gochecknoglobals

Go
var testStartTime = time.Now() //nolint:gochecknoglobals

func AssertGoldenJournals

Go
func AssertGoldenJournals(t *testing.T, graph *logseq.Graph, caseDirName string, pages []string)

func AssertGoldenPages

Go
func AssertGoldenPages(t *testing.T, graph *logseq.Graph, caseDirName string, pages []string)

func AssertPagesDontExist

Go
func AssertPagesDontExist(t *testing.T, graph *logseq.Graph, pages []string)

func CaptureOutput

Go
func CaptureOutput(function func()) string

CaptureOutput captures both stdout and stderr. It also works with the "color" package.

func RelativeTime

Go
func RelativeTime() time.Time

func StubBacklog

Go
func StubBacklog(t *testing.T, configPage, caseDirName string, apiResponses *StubAPIResponses) backlog.Backlog

func StubGraph

Go
func StubGraph(t *testing.T, caseDirName string) *logseq.Graph

StubGraph opens the example graph under "testdata" for testing.

func assertGoldenContent

Go
func assertGoldenContent(t *testing.T, graph *logseq.Graph, journals bool, caseDirName string, pages []string)

func stubJSONResponse

Go
func stubJSONResponse(t *testing.T, basename string) (string, error)

type QueryArg

Go
type QueryArg struct {
    Contains string
}

type StubAPIResponses

Go
type StubAPIResponses struct {
    Queries []QueryArg
}

type mockLogseqAPI

Go
type mockLogseqAPI struct {
    mock.Mock

    t         *testing.T
    responses *StubAPIResponses
}

func newMockLogseqAPI

Go
func newMockLogseqAPI(t *testing.T, responses StubAPIResponses) *mockLogseqAPI

func (*mockLogseqAPI) PostQuery

Go
func (m *mockLogseqAPI) PostQuery(query string) (string, error)

Generated by gomarkdoc