-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
318 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/integration/query/all_commits/with_dockey_typename_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2022 Democratized Data Foundation | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package all_commits | ||
|
||
import ( | ||
"testing" | ||
|
||
testUtils "github.com/sourcenetwork/defradb/tests/integration" | ||
) | ||
|
||
func TestQueryAllCommitsWithDockeyWithTypeName(t *testing.T) { | ||
test := testUtils.QueryTestCase{ | ||
Description: "Simple all commits query with dockey and typename", | ||
Query: `query { | ||
allCommits(dockey: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f") { | ||
cid | ||
__typename | ||
} | ||
}`, | ||
Docs: map[int][]string{ | ||
0: { | ||
`{ | ||
"Name": "John", | ||
"Age": 21 | ||
}`, | ||
}, | ||
}, | ||
Results: []map[string]any{ | ||
{ | ||
"cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", | ||
"__typename": "Commit", | ||
}, | ||
{ | ||
"cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", | ||
"__typename": "Commit", | ||
}, | ||
{ | ||
"cid": "bafybeid57gpbwi4i6bg7g357vwwyzsmr4bjo22rmhoxrwqvdxlqxcgaqvu", | ||
"__typename": "Commit", | ||
}, | ||
}, | ||
} | ||
|
||
executeTestCase(t, test) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2022 Democratized Data Foundation | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package one_to_many | ||
|
||
import ( | ||
"testing" | ||
|
||
testUtils "github.com/sourcenetwork/defradb/tests/integration" | ||
) | ||
|
||
func TestQueryOneToManyWithTypeName(t *testing.T) { | ||
test := testUtils.QueryTestCase{ | ||
Description: "One-to-many relation query from one side with typename", | ||
Query: `query { | ||
book { | ||
name | ||
__typename | ||
author { | ||
name | ||
__typename | ||
} | ||
} | ||
}`, | ||
Docs: map[int][]string{ | ||
//books | ||
0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d | ||
`{ | ||
"name": "Painted House", | ||
"rating": 4.9, | ||
"author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" | ||
}`, | ||
}, | ||
//authors | ||
1: { // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 | ||
`{ | ||
"name": "John Grisham", | ||
"age": 65, | ||
"verified": true | ||
}`, | ||
}, | ||
}, | ||
Results: []map[string]any{ | ||
{ | ||
"name": "Painted House", | ||
"__typename": "book", | ||
"author": map[string]any{ | ||
"name": "John Grisham", | ||
"__typename": "author", | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
executeTestCase(t, test) | ||
} |
77 changes: 77 additions & 0 deletions
77
tests/integration/query/simple/with_group_typename_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2022 Democratized Data Foundation | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package simple | ||
|
||
import ( | ||
"testing" | ||
|
||
testUtils "github.com/sourcenetwork/defradb/tests/integration" | ||
) | ||
|
||
func TestQuerySimpleWithGroupByWithTypeName(t *testing.T) { | ||
test := testUtils.QueryTestCase{ | ||
Description: "Simple query group by and parent typename", | ||
Query: `query { | ||
users(groupBy: [Name]) { | ||
Name | ||
__typename | ||
} | ||
}`, | ||
Docs: map[int][]string{ | ||
0: { | ||
`{ | ||
"Name": "John" | ||
}`, | ||
}, | ||
}, | ||
Results: []map[string]any{ | ||
{ | ||
"Name": "John", | ||
"__typename": "users", | ||
}, | ||
}, | ||
} | ||
|
||
executeTestCase(t, test) | ||
} | ||
|
||
func TestQuerySimpleWithGroupByWithChildTypeName(t *testing.T) { | ||
test := testUtils.QueryTestCase{ | ||
Description: "Simple query group by and child typename", | ||
Query: `query { | ||
users(groupBy: [Name]) { | ||
Name | ||
_group { | ||
__typename | ||
} | ||
} | ||
}`, | ||
Docs: map[int][]string{ | ||
0: { | ||
`{ | ||
"Name": "John" | ||
}`, | ||
}, | ||
}, | ||
Results: []map[string]any{ | ||
{ | ||
"Name": "John", | ||
"_group": []map[string]any{ | ||
{ | ||
"__typename": "users", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
executeTestCase(t, test) | ||
} |
Oops, something went wrong.