repository

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestRepository

func TestRepository(t *testing.T, newInitializedRepository func() def.Repository, debug bool)

TestRepository is an acceptance test set for Repository interface. Only those which can pass this test are considered conformers of the interface.

This test uses repository instances returned from newInitializedRepository. The function will be called multiple times. The test uses each instance however only one instance is used at a time. Therefore an invocation may invalidate all instances it has returned.

func TestRepository_can_find_tasks

func TestRepository_can_find_tasks(t *testing.T, repo def.Repository, debug bool)

func TestRepository_dispatched_tasks_can_be_marked_as_done

func TestRepository_dispatched_tasks_can_be_marked_as_done(
	t *testing.T,
	repo def.Repository,
	debug bool,
)

func TestRepository_next_task_can_be_fetched

func TestRepository_next_task_can_be_fetched(t *testing.T, repo def.Repository, debug bool)

func TestRepository_tasks_can_be_added

func TestRepository_tasks_can_be_added(t *testing.T, repo def.Repository, debug bool)

It ensures

  • All possible None / Some combination is acceptable
  • Id's are auto-generated and not overlapping at least for 300 elements
  • An user can fetch added tasks by calling GetById.
  • It returns ErrInvalidTask if some specific field of TaskUpdateParam is empty.

func TestRepository_tasks_can_be_cancelled

func TestRepository_tasks_can_be_cancelled(t *testing.T, repo def.Repository, debug bool)

func TestRepository_tasks_can_be_fetched_by_id

func TestRepository_tasks_can_be_fetched_by_id(t *testing.T, repo def.Repository, debug bool)

func TestRepository_tasks_can_be_marked_as_dispatched

func TestRepository_tasks_can_be_marked_as_dispatched(
	t *testing.T,
	repo def.Repository,
	debug bool,
)

func TestRepository_tasks_can_be_updated

func TestRepository_tasks_can_be_updated(t *testing.T, repo def.Repository, debug bool)

Types

type EachStateTask

type EachStateTask struct {
	Scheduled, Cancelled, Dispatched, Done, Err def.Task
}

func CreateEachState

func CreateEachState(t *testing.T, repo def.Repository) EachStateTask