-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from proto-graphql/izumin5210/import-from-sam…
…e-pkg Add test for importing types from the same package
- Loading branch information
Showing
24 changed files
with
732 additions
and
2 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
23 changes: 23 additions & 0 deletions
23
...tests/nexus--edgecases-import_from_same_pkg--google-protobuf/__generated__/schema.graphql
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
e2e/tests/nexus--edgecases-import_from_same_pkg--google-protobuf/schema.ts
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,14 @@ | ||
import { ParentMessage } from "@testapis/node-native/lib/testapis/edgecases/import_from_same_pkg/parent_pb"; | ||
import { queryField } from "nexus"; | ||
import { makeTestSchema } from "../../src/makeTestSchema"; | ||
import * as parentTypes from "../__generated__/nexus/google-protobuf/testapis/edgecases/import_from_same_pkg/parent_pb_nexus"; | ||
import * as childTypes from "../__generated__/nexus/google-protobuf/testapis/edgecases/import_from_same_pkg/child_pb_nexus"; | ||
|
||
const testQuery = queryField("test1", { | ||
type: "ParentMessage", | ||
resolve() { | ||
return new ParentMessage(); | ||
}, | ||
}); | ||
|
||
export const schema = makeTestSchema({ rootDir: __dirname, types: [parentTypes, childTypes, testQuery] }); |
15 changes: 15 additions & 0 deletions
15
e2e/tests/nexus--edgecases-import_from_same_pkg--google-protobuf/tsconfig.json
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,15 @@ | ||
// Code generated by setupTests.mjs. DO NOT EDIT. | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"@testapp/*": ["./*"] | ||
} | ||
}, | ||
"include": [ | ||
"./**/*", | ||
"../../src/**/*", | ||
"../__generated__/nexus/google-protobuf/testapis/edgecases/import_from_same_pkg/**/*" | ||
] | ||
} |
23 changes: 23 additions & 0 deletions
23
e2e/tests/nexus--edgecases-import_from_same_pkg--protobufjs/__generated__/schema.graphql
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
e2e/tests/nexus--edgecases-import_from_same_pkg--protobufjs/schema.ts
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,14 @@ | ||
import * as pbjs from "@testapis/node/lib/testapis/edgecases/import_from_same_pkg"; | ||
import { queryField } from "nexus"; | ||
import { makeTestSchema } from "../../src/makeTestSchema"; | ||
import * as parentTypes from "../__generated__/nexus/protobufjs/testapis/edgecases/import_from_same_pkg/parent_pb_nexus"; | ||
import * as childTypes from "../__generated__/nexus/protobufjs/testapis/edgecases/import_from_same_pkg/child_pb_nexus"; | ||
|
||
const testQuery = queryField("test1", { | ||
type: "ParentMessage", | ||
resolve() { | ||
return new pbjs.testapis.edgecases.import_from_same_pkg.ParentMessage(); | ||
}, | ||
}); | ||
|
||
export const schema = makeTestSchema({ rootDir: __dirname, types: [parentTypes, childTypes, testQuery] }); |
15 changes: 15 additions & 0 deletions
15
e2e/tests/nexus--edgecases-import_from_same_pkg--protobufjs/tsconfig.json
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,15 @@ | ||
// Code generated by setupTests.mjs. DO NOT EDIT. | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"@testapp/*": ["./*"] | ||
} | ||
}, | ||
"include": [ | ||
"./**/*", | ||
"../../src/**/*", | ||
"../__generated__/nexus/protobufjs/testapis/edgecases/import_from_same_pkg/**/*" | ||
] | ||
} |
19 changes: 19 additions & 0 deletions
19
e2e/tests/pothos--edgecases-import_from_same_pkg--ts-proto/__generated__/schema.graphql
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
e2e/tests/pothos--edgecases-import_from_same_pkg--ts-proto/builder.ts
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,4 @@ | ||
import SchemaBuilder from "@pothos/core"; | ||
|
||
export const builder = new SchemaBuilder({}); | ||
builder.queryType({}); |
28 changes: 28 additions & 0 deletions
28
e2e/tests/pothos--edgecases-import_from_same_pkg--ts-proto/schema.test.ts
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,28 @@ | ||
import { graphql } from "graphql"; | ||
import { schema } from "./schema"; | ||
|
||
it("processes a query successfully", async () => { | ||
const resp = await graphql( | ||
schema, | ||
/* GraphQL */ ` | ||
query Test { | ||
test { | ||
child { | ||
body | ||
} | ||
} | ||
} | ||
` | ||
); | ||
expect(resp).toMatchInlineSnapshot(` | ||
Object { | ||
"data": Object { | ||
"test": Object { | ||
"child": Object { | ||
"body": "hello", | ||
}, | ||
}, | ||
}, | ||
} | ||
`); | ||
}); |
21 changes: 21 additions & 0 deletions
21
e2e/tests/pothos--edgecases-import_from_same_pkg--ts-proto/schema.ts
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,21 @@ | ||
import { ParentMessage } from "@testapis/ts-proto/lib/testapis/edgecases/import_from_same_pkg/parent"; | ||
import { printGraphqlSchema } from "../../src/printGraphqlSchema"; | ||
import { ParentMessage$Ref } from "../__generated__/pothos/ts-proto/testapis/edgecases/import_from_same_pkg/parent.pb.pothos"; | ||
import { builder } from "./builder"; | ||
|
||
builder.queryField("test", (t) => | ||
t.field({ | ||
type: ParentMessage$Ref, | ||
resolve() { | ||
return ParentMessage.fromPartial({ | ||
child: { | ||
body: "hello", | ||
}, | ||
}); | ||
}, | ||
}) | ||
); | ||
|
||
export const schema = builder.toSchema(); | ||
|
||
printGraphqlSchema({ schema, rootDir: __dirname }); |
15 changes: 15 additions & 0 deletions
15
e2e/tests/pothos--edgecases-import_from_same_pkg--ts-proto/tsconfig.json
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,15 @@ | ||
// Code generated by setupTests.mjs. DO NOT EDIT. | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"@testapp/*": ["./*"] | ||
} | ||
}, | ||
"include": [ | ||
"./**/*", | ||
"../../src/**/*", | ||
"../__generated__/pothos/ts-proto/testapis/edgecases/import_from_same_pkg/**/*" | ||
] | ||
} |
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
7 changes: 7 additions & 0 deletions
7
packages/@testapis/proto/src/testapis/edgecases/import_from_same_pkg/child.proto
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,7 @@ | ||
syntax = "proto3"; | ||
|
||
package testapis.edgecases.import_from_same_pkg; | ||
|
||
message ChildMessage { | ||
string body = 1; | ||
} |
Binary file added
BIN
+623 Bytes
packages/@testapis/proto/src/testapis/edgecases/import_from_same_pkg/descriptor_set.pb
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
packages/@testapis/proto/src/testapis/edgecases/import_from_same_pkg/parent.proto
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,9 @@ | ||
syntax = "proto3"; | ||
|
||
package testapis.edgecases.import_from_same_pkg; | ||
|
||
import "testapis/edgecases/import_from_same_pkg/child.proto"; | ||
|
||
message ParentMessage { | ||
testapis.edgecases.import_from_same_pkg.ChildMessage child = 1; | ||
} |
Oops, something went wrong.