aboutsummaryrefslogtreecommitdiff
path: root/pkg/database/error_test.go
blob: f6f86922c7c880745a4be863de8d8d64fb41af22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package database

import (
	"reflect"
	"testing"

	"github.com/stretchr/testify/require"
)

func requireErrorTypeMatch(t *testing.T, err error, expected error) {
	require.Equalf(t, reflect.TypeOf(err), reflect.TypeOf(expected), "Invalid error type. Got %s but expected %s", reflect.TypeOf(err), reflect.TypeOf(expected))
}

func TestErrorsCoverage(t *testing.T) {
	initErr := InitError{}
	_ = initErr.Error()
	_ = initErr.Unwrap()
	migrationErr := MigrationError{}
	_ = migrationErr.Error()
	_ = migrationErr.Unwrap()
	passwordError := PasswordError{}
	_ = passwordError.Error()
	_ = passwordError.Unwrap()
	queryErr := QueryError{}
	_ = queryErr.Error()
	_ = queryErr.Unwrap()
	transactionErr := TransactionError{}
	_ = transactionErr.Error()
	_ = transactionErr.Unwrap()
}