Skip to content

Commit

Permalink
test: update completion test
Browse files Browse the repository at this point in the history
  • Loading branch information
RutZap committed Jan 15, 2025
1 parent e452115 commit 1a4c422
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
22 changes: 11 additions & 11 deletions schema/completions/completions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func TestFieldCompletions(t *testing.T) {
name Te<Cursor>
}
}`,
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Duration", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
},
{
name: "field-type-whitespace",
Expand All @@ -304,7 +304,7 @@ func TestFieldCompletions(t *testing.T) {
name <Cursor>
}
}`,
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Duration", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
},
{
name: "field-type-previous-optional",
Expand All @@ -315,7 +315,7 @@ func TestFieldCompletions(t *testing.T) {
myField <Cursor>
}
}`,
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Duration", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
},
{
name: "field-type-previous-list",
Expand All @@ -326,7 +326,7 @@ func TestFieldCompletions(t *testing.T) {
myField <Cursor>
}
}`,
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Duration", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
},
{
name: "field-type-complex",
Expand All @@ -342,7 +342,7 @@ func TestFieldCompletions(t *testing.T) {
myField <Cursor>
}
}`,
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
expected: []string{"Foo", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Duration", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
},
{
name: "field-type-model",
Expand All @@ -354,7 +354,7 @@ func TestFieldCompletions(t *testing.T) {
author Au<Cursor>
}
}`,
expected: []string{"Author", "Book", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
expected: []string{"Author", "Book", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Duration", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
},
{
name: "field-type-model-multi-file",
Expand All @@ -367,7 +367,7 @@ func TestFieldCompletions(t *testing.T) {
otherSchema: `
model Author {}
`,
expected: []string{"Author", "Book", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
expected: []string{"Author", "Book", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Duration", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
},
{
name: "field-type-enum",
Expand All @@ -382,7 +382,7 @@ func TestFieldCompletions(t *testing.T) {
Romance
Horror
}`,
expected: []string{"Book", "Category", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
expected: []string{"Book", "Category", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Duration", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
},
{
name: "field-type-enum-multi-file",
Expand All @@ -399,7 +399,7 @@ func TestFieldCompletions(t *testing.T) {
Horror
}
`,
expected: []string{"Book", "Category", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
expected: []string{"Book", "Category", "Identity", "ID", "Text", "File", "Markdown", "Number", "Decimal", "Duration", "Boolean", "Date", "Timestamp", "Vector", "Secret", "Password"},
},
// attributes tests
{
Expand Down Expand Up @@ -1801,7 +1801,7 @@ func TestMessageCompletions(t *testing.T) {
foo <Cursor>
}
`,
expected: []string{"AnotherMessage", "Boolean", "Date", "Decimal", "ID", "Identity", "MyMessage", "File", "Markdown", "Number", "Password", "RequestPasswordResetInput", "RequestPasswordResetResponse", "ResetPasswordInput", "ResetPasswordResponse", "Secret", "Text", "Timestamp", "Vector"},
expected: []string{"AnotherMessage", "Boolean", "Date", "Decimal", "Duration", "ID", "Identity", "MyMessage", "File", "Markdown", "Number", "Password", "RequestPasswordResetInput", "RequestPasswordResetResponse", "ResetPasswordInput", "ResetPasswordResponse", "Secret", "Text", "Timestamp", "Vector"},
},
}

Expand Down Expand Up @@ -1836,7 +1836,7 @@ func TestJobCompletions(t *testing.T) {
}
}
`,
expected: []string{"Boolean", "Date", "Decimal", "ID", "Identity", "File", "Markdown", "Number", "Password", "Secret", "Text", "Timestamp", "Vector"},
expected: []string{"Boolean", "Date", "Decimal", "Duration", "ID", "Identity", "File", "Markdown", "Number", "Password", "Secret", "Text", "Timestamp", "Vector"},
},
}

Expand Down
9 changes: 0 additions & 9 deletions schema/makeproto.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,15 +796,6 @@ func makeDurationQueryInputMessage(name string) *proto.Message {
Type: proto.Type_TYPE_DURATION,
},
},
{
MessageName: name,
Name: "oneOf",
Optional: true,
Type: &proto.TypeInfo{
Type: proto.Type_TYPE_DURATION,
Repeated: true,
},
},
}}
}

Expand Down
1 change: 1 addition & 0 deletions schema/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (f *FieldNode) IsScalar() bool {
FieldTypeID,
FieldTypePassword,
FieldTypeMarkdown,
FieldTypeDuration,
FieldTypeVector:
return true
default:
Expand Down

0 comments on commit 1a4c422

Please sign in to comment.