-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test scaffolding for vscode-graphql-syntax (option 2) (#3273)
--------- Co-authored-by: AaronMoat <AaronMoat@users.noreply.github.com> Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com> Co-authored-by: Rikki Schulte <rikki.schulte@gmail.com>
- Loading branch information
1 parent
23bd9c9
commit d314dc7
Showing
36 changed files
with
1,955 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,7 @@ lezer | |
manypkg | ||
meros | ||
nullthrows | ||
onig | ||
ovsx | ||
picomatch | ||
pnpm | ||
|
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
**/.browserslistrc/** | ||
tests |
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
66 changes: 66 additions & 0 deletions
66
packages/vscode-graphql-syntax/tests/__fixtures__/StarWarsSchema.graphql
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,66 @@ | ||
schema { | ||
query: Query | ||
} | ||
|
||
directive @test(testArg: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
directive @onArg on ARGUMENT_DEFINITION | ||
directive @onAllDefs on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | UNION | ENUM_VALUE | INPUT_OBJECT | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ||
|
||
enum Episode { | ||
NEWHOPE | ||
EMPIRE | ||
JEDI | ||
} | ||
|
||
interface Character { | ||
id: String! | ||
name: String | ||
friends: [Character] | ||
appearsIn: [Episode] | ||
secretBackstory: String | ||
} | ||
|
||
type Human implements Character { | ||
id: String! | ||
name: String | ||
friends: [Character] | ||
appearsIn: [Episode] | ||
secretBackstory: String | ||
} | ||
|
||
type Droid implements Character { | ||
id: String! | ||
name: String | ||
friends: [Character] | ||
appearsIn: [Episode] | ||
secretBackstory: String | ||
primaryFunction: String | ||
instructions: [String]! | ||
} | ||
|
||
input InputType { | ||
key: String! | ||
value: Int = 42 | ||
} | ||
|
||
interface TestInterface { | ||
testField: String! | ||
} | ||
|
||
interface AnotherInterface implements TestInterface { | ||
testField: String! | ||
} | ||
|
||
type TestType implements TestInterface & AnotherInterface { | ||
testField: String! | ||
} | ||
|
||
type Query { | ||
hero(episode: Episode): Character | ||
human(id: String!): Human | ||
droid(id: String!): Droid | ||
inputTypeTest(args: InputType = { key: "key" }): TestType | ||
deprecatedField: TestType @deprecated(reason: "Use test instead.") | ||
} | ||
|
||
union TestUnion = Droid | TestType |
52 changes: 52 additions & 0 deletions
52
packages/vscode-graphql-syntax/tests/__fixtures__/kitchen-sink.graphql
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,52 @@ | ||
# Copyright (c) 2021 GraphQL Contributors | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
query queryName($foo: TestInput, $site: TestEnum = RED) { | ||
testAlias: hasArgs(string: "testString") | ||
... on Test { | ||
hasArgs( | ||
listEnum: [RED, GREEN, BLUE] | ||
int: 1 | ||
listFloat: [1.23, 1.3e-1, -1.35384e+3] | ||
boolean: true | ||
id: 123 | ||
object: $foo | ||
enum: $site | ||
) | ||
} | ||
test @include(if: true) { | ||
union { | ||
__typename | ||
} | ||
} | ||
...frag | ||
... @skip(if: false) { | ||
id | ||
} | ||
... { | ||
id | ||
} | ||
} | ||
|
||
mutation mutationName { | ||
setString(value: "newString") | ||
} | ||
|
||
subscription subscriptionName { | ||
subscribeToTest(id: "anId") { | ||
... on Test { | ||
id | ||
} | ||
} | ||
} | ||
|
||
fragment frag on Test { | ||
test @include(if: true) { | ||
union { | ||
__typename | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/vscode-graphql-syntax/tests/__fixtures__/query.graphql
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,6 @@ | ||
query simple { | ||
stuff(id: "1") { | ||
id | ||
name | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/vscode-graphql-syntax/tests/__fixtures__/test-sfc-comp.vue
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,18 @@ | ||
<!-- | ||
Say Hello World with Vue! | ||
--> | ||
|
||
<script setup> | ||
import { ref } from 'vue'; | ||
const query = gql` | ||
query { | ||
hello | ||
} | ||
`; | ||
|
||
const message = ref('Hello World!'); | ||
</script> | ||
|
||
<template> | ||
<h1>{{ message }}</h1> | ||
</template> |
18 changes: 18 additions & 0 deletions
18
packages/vscode-graphql-syntax/tests/__fixtures__/test-sfc.vue
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,18 @@ | ||
<script> | ||
const query = gql` | ||
query { | ||
hello | ||
} | ||
`; | ||
export default { | ||
data() { | ||
return { | ||
message: 'Hello World!', | ||
}; | ||
}, | ||
}; | ||
</script> | ||
|
||
<template> | ||
<h1>{{ message }}</h1> | ||
</template> |
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,42 @@ | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
gql` | ||
query { | ||
user(id: "5", name: boolean) { | ||
something | ||
} | ||
} | ||
`; | ||
|
||
graphql` | ||
query { | ||
user(id: "5", name: boolean) { | ||
something | ||
} | ||
} | ||
`; | ||
|
||
const graphql = graphql` | ||
query { | ||
user(id: "5", name: boolean) { | ||
something | ||
} | ||
} | ||
`; | ||
|
||
const queryWithInlineComment = `#graphql | ||
query { | ||
user(id: "5", name: boolean) { | ||
something | ||
} | ||
} | ||
`; | ||
|
||
const queryWithLeadingComment = /* GraphQL */ ` | ||
query { | ||
user(id: "5", name: boolean) { | ||
something | ||
} | ||
} | ||
`; |
28 changes: 28 additions & 0 deletions
28
packages/vscode-graphql-syntax/tests/__fixtures__/test.php
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 @@ | ||
<!-- these seem horribly regressed. please someone fix this grammar! --> | ||
|
||
$query = <<<GRAPHQL | ||
query { | ||
site { | ||
name | ||
} | ||
} | ||
GRAPHQL; | ||
|
||
$gql = <<<QUERY | ||
query { | ||
pokemon(name: "Pikachu") { | ||
id | ||
number | ||
name | ||
attacks { | ||
special { | ||
name | ||
type | ||
damage | ||
} | ||
} | ||
} | ||
} | ||
QUERY; | ||
|
||
|
Oops, something went wrong.