test

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package test provides a fake implementation of InviteService for testing Initially generated by Claude Sonnet 4.5 with the following prompt: > Generate a fake for the `InviteService` in the directory `internal/invites/fake`. > It should use a lightweight in-memory implementation to support creating and > tracking invites for tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeInviteService

type FakeInviteService struct {
	Time time.Time // Optional fixed time for testing
	// contains filtered or unexported fields
}

FakeInviteService is an in-memory implementation of InviteService for testing

func NewFakeInviteService

func NewFakeInviteService() *FakeInviteService

NewFakeInviteService creates a new fake invite service

func (*FakeInviteService) Clear

func (f *FakeInviteService) Clear()

Clear removes all invites (helper method for testing)

func (*FakeInviteService) CreateInvite

func (f *FakeInviteService) CreateInvite(
	ctx context.Context,
	_ db.Querier,
	_ interfaces.Publisher,
	emailConfig serverconfig.EmailConfig,
	targetProject uuid.UUID,
	authzRole authz.Role,
	inviteeEmail string,
) (*minder.Invitation, error)

CreateInvite creates a new user invite in memory

func (*FakeInviteService) GetAllInvites

func (f *FakeInviteService) GetAllInvites() []*storedInvite

GetAllInvites returns all invites (helper method for testing)

func (*FakeInviteService) GetInvite

func (f *FakeInviteService) GetInvite(
	ctx context.Context,
	_ db.Querier,
	code string,
) (*minder.Invitation, error)

GetInvite returns an invite by its code, or an error if none is found

func (*FakeInviteService) GetInviteByEmailAndProject

func (f *FakeInviteService) GetInviteByEmailAndProject(email string, project uuid.UUID) (*storedInvite, bool)

GetInviteByEmailAndProject retrieves an invite by email and project (helper method for testing)

func (*FakeInviteService) GetInvitesForEmail

func (f *FakeInviteService) GetInvitesForEmail(
	_ context.Context,
	_ db.Querier,
	targetProject uuid.UUID,
	inviteeEmail string,
) ([]*minder.Invitation, error)

GetInvitesForEmail returns invites for a given email and project

func (*FakeInviteService) GetInvitesForSelf

func (f *FakeInviteService) GetInvitesForSelf(
	ctx context.Context,
	_ db.Querier,
	_ auth.Resolver,
) ([]*minder.Invitation, error)

GetInvitesForSelf gets all invites for the current user (from context)

func (*FakeInviteService) ListInvitationsForProject

func (f *FakeInviteService) ListInvitationsForProject(
	_ context.Context,
	_ db.Querier,
	targetProject uuid.UUID,
) ([]*minder.Invitation, error)

ListInvitationsForProject lists all invitations for a project (admin view, no codes)

func (*FakeInviteService) RemoveInvite

func (f *FakeInviteService) RemoveInvite(
	_ context.Context,
	_ db.Querier,
	code string,
) error

RemoveInvite removes a user invite from memory by code

func (*FakeInviteService) UpdateInvite

func (f *FakeInviteService) UpdateInvite(
	ctx context.Context,
	_ db.Querier,
	_ interfaces.Publisher,
	emailConfig serverconfig.EmailConfig,
	targetProject uuid.UUID,
	authzRole authz.Role,
	inviteeEmail string,
) (*minder.Invitation, error)

UpdateInvite updates an existing invite in memory

Jump to

Keyboard shortcuts

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