Skip to content

Commit

Permalink
test: Capitalize all integration schema types (#1445)
Browse files Browse the repository at this point in the history
This converts all schemas in the integrations folder to follow GQL best
practices' where the type name is capitalized and the fields are
lowercase.

The *only* things that should be changed throughout the PR is:
A) Capitalization of schema types, and lowercase of fields (this is also
represented through queries, mutations, etc)
B) CIDs - as the schemas are involved in generated the CIDs since the
`schemaVersionID` is embedded in the commits.
C) DocKeys - Same reason as above
D) Reordering of *some* request results as the implicit order (dockeys)
of various results have changed because of (C).

---------

Co-authored-by: Orpheus Lummis <[email protected]>
  • Loading branch information
jsimnz and orpheuslummis committed May 4, 2023
1 parent 1f1d5ce commit 574a247
Show file tree
Hide file tree
Showing 271 changed files with 2,840 additions and 2,826 deletions.
5 changes: 5 additions & 0 deletions docs/data_format_changes/i807-test-schemas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Integration Test Schema Changes

All the schema types in the integration test framework were changed to reflect GQL community best practises.

As schemas are embedded in blocks, they affect CIDs, Dockeys, etc. Therefore this is a change-detector breaking change.
110 changes: 55 additions & 55 deletions request/graphql/schema/descriptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ func TestSingleSimpleType(t *testing.T) {
{
description: "Single simple type",
sdl: `
type user {
type User {
name: String
age: Int
verified: Boolean
}
`,
targetDescs: []client.CollectionDescription{
{
Name: "user",
Name: "User",
Schema: client.SchemaDescription{
Name: "user",
Name: "User",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand Down Expand Up @@ -64,23 +64,23 @@ func TestSingleSimpleType(t *testing.T) {
{
description: "Multiple simple types",
sdl: `
type user {
type User {
name: String
age: Int
verified: Boolean
}
type author {
type Author {
name: String
publisher: String
rating: Float
}
`,
targetDescs: []client.CollectionDescription{
{
Name: "user",
Name: "User",
Schema: client.SchemaDescription{
Name: "user",
Name: "User",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -106,9 +106,9 @@ func TestSingleSimpleType(t *testing.T) {
},
},
{
Name: "author",
Name: "Author",
Schema: client.SchemaDescription{
Name: "author",
Name: "Author",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand Down Expand Up @@ -138,23 +138,23 @@ func TestSingleSimpleType(t *testing.T) {
{
description: "Multiple types with relations (one-to-one)",
sdl: `
type book {
type Book {
name: String
rating: Float
author: author
author: Author
}
type author {
type Author {
name: String
age: Int
published: book
published: Book
}
`,
targetDescs: []client.CollectionDescription{
{
Name: "book",
Name: "Book",
Schema: client.SchemaDescription{
Name: "book",
Name: "Book",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -166,7 +166,7 @@ func TestSingleSimpleType(t *testing.T) {
RelationName: "author_book",
Kind: client.FieldKind_FOREIGN_OBJECT,
Typ: client.NONE_CRDT,
Schema: "author",
Schema: "Author",
RelationType: client.Relation_Type_ONE | client.Relation_Type_ONEONE,
},
{
Expand All @@ -189,9 +189,9 @@ func TestSingleSimpleType(t *testing.T) {
},
},
{
Name: "author",
Name: "Author",
Schema: client.SchemaDescription{
Name: "author",
Name: "Author",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -213,7 +213,7 @@ func TestSingleSimpleType(t *testing.T) {
RelationName: "author_book",
Kind: client.FieldKind_FOREIGN_OBJECT,
Typ: client.NONE_CRDT,
Schema: "book",
Schema: "Book",
RelationType: client.Relation_Type_ONE | client.Relation_Type_ONEONE | client.Relation_Type_Primary,
},
{
Expand All @@ -230,23 +230,23 @@ func TestSingleSimpleType(t *testing.T) {
{
description: "Multiple simple types",
sdl: `
type user {
type User {
name: String
age: Int
verified: Boolean
}
type author {
type Author {
name: String
publisher: String
rating: Float
}
`,
targetDescs: []client.CollectionDescription{
{
Name: "user",
Name: "User",
Schema: client.SchemaDescription{
Name: "user",
Name: "User",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -272,9 +272,9 @@ func TestSingleSimpleType(t *testing.T) {
},
},
{
Name: "author",
Name: "Author",
Schema: client.SchemaDescription{
Name: "author",
Name: "Author",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand Down Expand Up @@ -304,23 +304,23 @@ func TestSingleSimpleType(t *testing.T) {
{
description: "Multiple types with relations (one-to-one)",
sdl: `
type book {
type Book {
name: String
rating: Float
author: author @relation(name:"book_authors")
author: Author @relation(name:"book_authors")
}
type author {
type Author {
name: String
age: Int
published: book @relation(name:"book_authors")
published: Book @relation(name:"book_authors")
}
`,
targetDescs: []client.CollectionDescription{
{
Name: "book",
Name: "Book",
Schema: client.SchemaDescription{
Name: "book",
Name: "Book",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -332,7 +332,7 @@ func TestSingleSimpleType(t *testing.T) {
RelationName: "book_authors",
Kind: client.FieldKind_FOREIGN_OBJECT,
Typ: client.NONE_CRDT,
Schema: "author",
Schema: "Author",
RelationType: client.Relation_Type_ONE | client.Relation_Type_ONEONE,
},
{
Expand All @@ -355,9 +355,9 @@ func TestSingleSimpleType(t *testing.T) {
},
},
{
Name: "author",
Name: "Author",
Schema: client.SchemaDescription{
Name: "author",
Name: "Author",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -379,7 +379,7 @@ func TestSingleSimpleType(t *testing.T) {
RelationName: "book_authors",
Kind: client.FieldKind_FOREIGN_OBJECT,
Typ: client.NONE_CRDT,
Schema: "book",
Schema: "Book",
RelationType: client.Relation_Type_ONE | client.Relation_Type_ONEONE | client.Relation_Type_Primary,
},
{
Expand All @@ -396,23 +396,23 @@ func TestSingleSimpleType(t *testing.T) {
{
description: "Multiple types with relations (one-to-one) with directive",
sdl: `
type book {
type Book {
name: String
rating: Float
author: author @primary
author: Author @primary
}
type author {
type Author {
name: String
age: Int
published: book
published: Book
}
`,
targetDescs: []client.CollectionDescription{
{
Name: "book",
Name: "Book",
Schema: client.SchemaDescription{
Name: "book",
Name: "Book",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -424,7 +424,7 @@ func TestSingleSimpleType(t *testing.T) {
RelationName: "author_book",
Kind: client.FieldKind_FOREIGN_OBJECT,
Typ: client.NONE_CRDT,
Schema: "author",
Schema: "Author",
RelationType: client.Relation_Type_ONE | client.Relation_Type_ONEONE | client.Relation_Type_Primary,
},
{
Expand All @@ -447,9 +447,9 @@ func TestSingleSimpleType(t *testing.T) {
},
},
{
Name: "author",
Name: "Author",
Schema: client.SchemaDescription{
Name: "author",
Name: "Author",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -471,7 +471,7 @@ func TestSingleSimpleType(t *testing.T) {
RelationName: "author_book",
Kind: client.FieldKind_FOREIGN_OBJECT,
Typ: client.NONE_CRDT,
Schema: "book",
Schema: "Book",
RelationType: client.Relation_Type_ONE | client.Relation_Type_ONEONE,
},
{
Expand All @@ -488,23 +488,23 @@ func TestSingleSimpleType(t *testing.T) {
{
description: "Multiple types with relations (one-to-many)",
sdl: `
type book {
type Book {
name: String
rating: Float
author: author
author: Author
}
type author {
type Author {
name: String
age: Int
published: [book]
published: [Book]
}
`,
targetDescs: []client.CollectionDescription{
{
Name: "book",
Name: "Book",
Schema: client.SchemaDescription{
Name: "book",
Name: "Book",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -516,7 +516,7 @@ func TestSingleSimpleType(t *testing.T) {
RelationName: "author_book",
Kind: client.FieldKind_FOREIGN_OBJECT,
Typ: client.NONE_CRDT,
Schema: "author",
Schema: "Author",
RelationType: client.Relation_Type_ONE | client.Relation_Type_ONEMANY | client.Relation_Type_Primary,
},
{
Expand All @@ -539,9 +539,9 @@ func TestSingleSimpleType(t *testing.T) {
},
},
{
Name: "author",
Name: "Author",
Schema: client.SchemaDescription{
Name: "author",
Name: "Author",
Fields: []client.FieldDescription{
{
Name: "_key",
Expand All @@ -563,7 +563,7 @@ func TestSingleSimpleType(t *testing.T) {
RelationName: "author_book",
Kind: client.FieldKind_FOREIGN_OBJECT_ARRAY,
Typ: client.NONE_CRDT,
Schema: "book",
Schema: "Book",
RelationType: client.Relation_Type_MANY | client.Relation_Type_ONEMANY,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func TestCreateSaveErrorsGivenValueInRelationField(t *testing.T) {
doc, err := client.NewDocFromJSON(
[]byte(
`{
"Name": "Painted House",
"Author": "ValueDoesntMatter"
"name": "Painted House",
"author": "ValueDoesntMatter"
}`,
),
)
Expand All @@ -35,7 +35,7 @@ func TestCreateSaveErrorsGivenValueInRelationField(t *testing.T) {

test := testUtils.TestCase{
CollectionCalls: map[string][]func(client.Collection) error{
"book": []func(c client.Collection) error{
"Book": []func(c client.Collection) error{
func(c client.Collection) error {
return c.Save(context.Background(), doc)
},
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/collection/create/one_to_many/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import (
)

var schema = (`
type book {
Name: String
Rating: Float
Author: author
type Book {
name: String
rating: Float
author: Author
}
type author {
Name: String
Age: Int
Verified: Boolean
Published: [book]
type Author {
name: String
age: Int
verified: Boolean
published: [Book]
}
`)

Expand Down
Loading

0 comments on commit 574a247

Please sign in to comment.