fix: empty notebooks list returns empty array (#21588)

pull/21590/head^2
William Baker 2021-06-02 14:33:37 -04:00 committed by GitHub
parent 75594094f5
commit b928d3bda4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -137,7 +137,7 @@ func (s *Service) DeleteNotebook(ctx context.Context, id platform.ID) error {
// ListNotebooks lists notebooks matching the provided filter. Currently, only org_id is used in the filter.
// Future uses may support pagination via this filter as well.
func (s *Service) ListNotebooks(ctx context.Context, filter influxdb.NotebookListFilter) ([]*influxdb.Notebook, error) {
var ns []*influxdb.Notebook
ns := []*influxdb.Notebook{}
query := `
SELECT id, org_id, name, spec, created_at, updated_at

View File

@ -154,7 +154,7 @@ func TestList(t *testing.T) {
// selecting with no matches for org_id should return an empty list and no error
got, err := svc.ListNotebooks(ctx, influxdb.NotebookListFilter{OrgID: orgID})
require.NoError(t, err)
require.Equal(t, 0, len(got))
require.Equal(t, []*influxdb.Notebook{}, got)
// create some notebooks to test the list operation with
creates := []*influxdb.NotebookReqBody{