refac: stale test entries, failing web tests, Postgre backup bug, Hardcoded MySQL table count, Stale Postgre connection in test, own-scope visibility filter, GetAll ignoring its error, JSON tags in use-case types, 31 copies of DESKTOP_QUERY, ProfileView endpoint paths
This commit is contained in:
1 parent
efecdee200
commit
5d6f378fce
87 files changed
+696
-373
No files matched your search
@@ -207,7 +207,7 @@ func runRepositoryContract(t *testing.T, backend contractBackend) {
|
||||
if err == nil {
|
||||
t.Error("expected an error for the duplicate email")
|
||||
}
|
||||
if all := repos.users.GetAll(); len(all) != 1 || all[0].Username != "first" {
|
||||
if all := allOf(repos.users.GetAll()); len(all) != 1 || all[0].Username != "first" {
|
||||
t.Errorf("nothing may be stored for the failed create, got %+v", all)
|
||||
}
|
||||
}},
|
||||
@@ -231,7 +231,7 @@ func runRepositoryContract(t *testing.T, backend contractBackend) {
|
||||
if !errors.Is(secondErr, domainInvite.ErrInviteNotFound) {
|
||||
t.Errorf("expected ErrInviteNotFound, got %v", secondErr)
|
||||
}
|
||||
if len(repos.users.GetAll()) != 1 {
|
||||
if len(allOf(repos.users.GetAll())) != 1 {
|
||||
t.Errorf("only the first accept may create a user")
|
||||
}
|
||||
}},
|
||||
@@ -244,7 +244,7 @@ func runRepositoryContract(t *testing.T, backend contractBackend) {
|
||||
if err == nil {
|
||||
t.Fatal("expected the taken username to be refused")
|
||||
}
|
||||
invites := repos.invites.GetAll()
|
||||
invites := allOf(repos.invites.GetAll())
|
||||
if len(invites) != 1 || invites[0].AcceptedAt != nil {
|
||||
t.Errorf("the invite must stay pending, got %+v", invites)
|
||||
}
|
||||
@@ -366,3 +366,10 @@ func TestSQLiteRepositoryContract(t *testing.T) {
|
||||
func TestMySQLRepositoryContract(t *testing.T) {
|
||||
runRepositoryContract(t, contractBackend{name: "mysql", open: openContractMySQL})
|
||||
}
|
||||
|
||||
func allOf[T any](all []T, err error) []T {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return all
|
||||
}
|
||||
Reference in new issue
Block a user