Documentation
¶
Index ¶
- func AssertContains[T comparable](t *testing.T, slice []T, elem T)
- func AssertEqual[T comparable](t *testing.T, want, got T)
- func AssertError(t *testing.T, err error)
- func AssertJSONEqual(t *testing.T, want, got any)
- func AssertLen[T any](t *testing.T, slice []T, want int)
- func AssertNoError(t *testing.T, err error)
- func AssertNotEqual[T comparable](t *testing.T, notWant, got T)
- func NewTestDB(t *testing.T) *dbgen.Queries
- func NewTestDBWithSQL(t *testing.T) (*dbgen.Queries, *sql.DB)
- func SeedGrabHistory(t *testing.T, q *dbgen.Queries, movieID, title string) dbgen.GrabHistory
- func SeedLibrary(t *testing.T, q *dbgen.Queries) dbgen.Library
- func SeedLibraryWithProfile(t *testing.T, q *dbgen.Queries, profileID string) dbgen.Library
- func SeedMovie(t *testing.T, q *dbgen.Queries, opts ...MovieOption) dbgen.Movie
- func SeedMovieInLibrary(t *testing.T, q *dbgen.Queries, libraryID, profileID string, ...) dbgen.Movie
- func SeedQualityProfile(t *testing.T, q *dbgen.Queries) dbgen.QualityProfile
- type MovieOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertContains ¶
func AssertContains[T comparable](t *testing.T, slice []T, elem T)
AssertContains calls t.Errorf if slice does not contain elem.
func AssertEqual ¶
func AssertEqual[T comparable](t *testing.T, want, got T)
AssertEqual calls t.Errorf if got != want.
func AssertError ¶
AssertError calls t.Fatal if err is nil.
func AssertJSONEqual ¶
AssertJSONEqual marshals both values to JSON and compares the results. Useful for comparing structs that contain unexported fields or time.Time values.
func AssertNoError ¶
AssertNoError calls t.Fatal if err is non-nil.
func AssertNotEqual ¶
func AssertNotEqual[T comparable](t *testing.T, notWant, got T)
AssertNotEqual calls t.Errorf if got == notWant.
func NewTestDB ¶
NewTestDB creates a fresh SQLite database with all migrations applied. The database is registered with t.Cleanup to be closed after the test completes. Each call gets its own file under t.TempDir() so tests never share state.
func NewTestDBWithSQL ¶
NewTestDBWithSQL returns both the Queries and the underlying *sql.DB. Use this when you need to execute raw SQL in tests (e.g. for low-level assertions).
func SeedGrabHistory ¶
SeedGrabHistory inserts one grab_history row for movieID and returns it.
func SeedLibrary ¶
SeedLibrary inserts a library backed by a freshly created quality profile.
func SeedLibraryWithProfile ¶
SeedLibraryWithProfile inserts a library using the given quality profile ID.
func SeedMovieInLibrary ¶
func SeedMovieInLibrary(t *testing.T, q *dbgen.Queries, libraryID, profileID string, opts ...MovieOption) dbgen.Movie
SeedMovieInLibrary inserts a movie into the specified library.
func SeedQualityProfile ¶
SeedQualityProfile inserts a quality profile with sensible defaults and returns it. The inserted profile accepts 1080p BluRay releases.
Types ¶
type MovieOption ¶
type MovieOption func(*dbgen.CreateMovieParams)
MovieOption is a functional option for SeedMovie.
func WithMonitored ¶
func WithMonitored(monitored bool) MovieOption
WithMonitored sets the monitored flag on the seeded movie.
func WithMovieStatus ¶
func WithMovieStatus(status string) MovieOption
WithMovieStatus sets the status field on the seeded movie.
func WithTMDBID ¶
func WithTMDBID(id int) MovieOption
WithTMDBID sets the TMDB ID on the seeded movie.