Skip to content

Commit b99d262

Browse files
committed
Remove outdated tests
1 parent 5f3b402 commit b99d262

File tree

1 file changed

+1
-128
lines changed

1 file changed

+1
-128
lines changed

database_test.go

Lines changed: 1 addition & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -92,68 +92,6 @@ func TestDatabaseClient(t *testing.T) {
9292
}
9393
})
9494

95-
t.Run("List", func(t *testing.T) {
96-
tests := []struct {
97-
name string
98-
filePath string
99-
statusCode int
100-
want *notionapi.DatabaseListResponse
101-
wantErr bool
102-
err error
103-
}{
104-
{
105-
name: "returns list of databases",
106-
filePath: "testdata/database_list.json",
107-
statusCode: http.StatusOK,
108-
want: &notionapi.DatabaseListResponse{
109-
Object: notionapi.ObjectTypeList,
110-
Results: []notionapi.Database{
111-
{
112-
Object: notionapi.ObjectTypeDatabase,
113-
ID: "some_id",
114-
CreatedTime: timestamp,
115-
LastEditedTime: timestamp,
116-
CreatedBy: user,
117-
LastEditedBy: user,
118-
Title: []notionapi.RichText{
119-
{
120-
Type: notionapi.ObjectTypeText,
121-
Text: notionapi.Text{
122-
Content: "Test Database",
123-
},
124-
Annotations: &notionapi.Annotations{
125-
Color: notionapi.ColorDefault,
126-
},
127-
PlainText: "Test Database",
128-
},
129-
},
130-
},
131-
},
132-
HasMore: false,
133-
},
134-
wantErr: false,
135-
},
136-
}
137-
138-
for _, tt := range tests {
139-
t.Run(tt.name, func(t *testing.T) {
140-
c := newMockedClient(t, tt.filePath, tt.statusCode)
141-
client := notionapi.NewClient("some_token", notionapi.WithHTTPClient(c))
142-
143-
got, err := client.Database.List(context.Background(), nil)
144-
145-
if (err != nil) != tt.wantErr {
146-
t.Errorf("List() error = %v, wantErr %v", err, tt.wantErr)
147-
return
148-
}
149-
got.Results[0].Properties = nil
150-
if !reflect.DeepEqual(got, tt.want) {
151-
t.Errorf("List() got = %v, want %v", got, tt.want)
152-
}
153-
})
154-
}
155-
})
156-
15795
t.Run("Query", func(t *testing.T) {
15896
tests := []struct {
15997
name string
@@ -171,7 +109,7 @@ func TestDatabaseClient(t *testing.T) {
171109
filePath: "testdata/database_query.json",
172110
statusCode: http.StatusOK,
173111
request: &notionapi.DatabaseQueryRequest{
174-
PropertyFilter: &notionapi.PropertyFilter{
112+
Filter: &notionapi.PropertyFilter{
175113
Property: "Name",
176114
RichText: &notionapi.TextFilterCondition{
177115
Contains: "Hel",
@@ -375,71 +313,6 @@ func TestDatabaseQueryRequest_MarshalJSON(t *testing.T) {
375313
want []byte
376314
wantErr bool
377315
}{
378-
{
379-
name: "with property filter without sort",
380-
req: &notionapi.DatabaseQueryRequest{
381-
PropertyFilter: &notionapi.PropertyFilter{
382-
Property: "Status",
383-
Select: &notionapi.SelectFilterCondition{
384-
Equals: "Reading",
385-
},
386-
},
387-
},
388-
want: []byte(`{"filter":{"property":"Status","select":{"equals":"Reading"}}}`),
389-
},
390-
{
391-
name: "with property filter with sort",
392-
req: &notionapi.DatabaseQueryRequest{
393-
PropertyFilter: &notionapi.PropertyFilter{
394-
Property: "Status",
395-
Select: &notionapi.SelectFilterCondition{
396-
Equals: "Reading",
397-
},
398-
},
399-
Sorts: []notionapi.SortObject{
400-
{
401-
Property: "Score /5",
402-
Direction: notionapi.SortOrderASC,
403-
},
404-
},
405-
},
406-
want: []byte(`{"sorts":[{"property":"Score /5","direction":"ascending"}],"filter":{"property":"Status","select":{"equals":"Reading"}}}`),
407-
},
408-
{
409-
name: "compound filter",
410-
req: &notionapi.DatabaseQueryRequest{
411-
CompoundFilter: &notionapi.CompoundFilter{
412-
notionapi.FilterOperatorOR: []notionapi.PropertyFilter{
413-
{
414-
Property: "Status",
415-
Select: &notionapi.SelectFilterCondition{
416-
Equals: "Reading",
417-
},
418-
},
419-
{
420-
Property: "Publisher",
421-
Select: &notionapi.SelectFilterCondition{
422-
Equals: "NYT",
423-
},
424-
},
425-
},
426-
},
427-
},
428-
want: []byte(`{"filter":{"or":[{"property":"Status","select":{"equals":"Reading"}},{"property":"Publisher","select":{"equals":"NYT"}}]}}`),
429-
},
430-
{
431-
name: "date filter",
432-
req: &notionapi.DatabaseQueryRequest{
433-
PropertyFilter: &notionapi.PropertyFilter{
434-
Property: "created_at",
435-
Date: &notionapi.DateFilterCondition{
436-
Equals: &dateObj,
437-
PastWeek: &struct{}{},
438-
},
439-
},
440-
},
441-
want: []byte(`{"filter":{"property":"created_at","date":{"equals":"2021-05-10T02:43:42Z","past_week":{}}}}`),
442-
},
443316
{
444317
name: "timestamp created",
445318
req: &notionapi.DatabaseQueryRequest{

0 commit comments

Comments
 (0)