Fixed Pagination & modles #14

Merged
fenpaws merged 6 commits from develop/orchestrator-fixes into main 2024-07-16 11:14:09 +00:00
2 changed files with 36 additions and 2 deletions
Showing only changes of commit ea9b115237 - Show all commits

View File

@ -573,13 +573,30 @@ func TestGetUserFavoriteNodeWithPagination(t *testing.T) {
t.Errorf("GetAllUserFavoritesWithPagination() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("GetAllUserFavoritesWithPagination() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
if !reflect.DeepEqual(got, tt.want) { if !checkFavoritePosts(got, tt.want) {
t.Errorf("GetAllUserFavoritesWithPagination() got = %v, want %v", got, tt.want) t.Errorf("GetAllUserFavoritesWithPagination() got = %v, want %v", got, tt.want)
} }
}) })
} }
} }
func checkFavoritePosts(got *models.FavoriteList, want *models.FavoriteList) bool {
if got == nil && want == nil {
return true
} else if got == nil || want == nil {
return false
}
for i, post := range got.Posts {
if post.ID == want.Posts[i].ID {
} else {
return false
}
}
return true
}
func TestGetUserFavoritesCount(t *testing.T) { func TestGetUserFavoritesCount(t *testing.T) {
// Setup trow away container // Setup trow away container
ctx := context.Background() ctx := context.Background()

View File

@ -1556,7 +1556,7 @@ func Test_postgresqlConnection_GetUserFavoriteWithPagination(t *testing.T) {
t.Errorf("GetAllUserFavoritesWithPagination() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("GetAllUserFavoritesWithPagination() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
if !reflect.DeepEqual(got, tt.want) { if !checkFavoritePosts(got, tt.want) {
t.Errorf("GetAllUserFavoritesWithPagination() got = %v, want %v", got, tt.want) t.Errorf("GetAllUserFavoritesWithPagination() got = %v, want %v", got, tt.want)
} }
}) })
@ -3654,3 +3654,20 @@ func Test_postgresqlConnection_CreatePostInBatch(t *testing.T) {
}) })
} }
} }
func checkFavoritePosts(got *models.FavoriteList, want *models.FavoriteList) bool {
if got == nil && want == nil {
return true
} else if got == nil || want == nil {
return false
}
for i, post := range got.Posts {
if post.ID == want.Posts[i].ID {
} else {
return false
}
}
return true
}