Skip to content

Commit f803d2b

Browse files
author
Oryan M
committed
Unify test strings indentation
1 parent a4777d0 commit f803d2b

21 files changed

+1100
-1059
lines changed

src/test/kotlin/graphql/kickstart/tools/BuiltInIdTest.kt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import java.util.*
88

99
class BuiltInIdTest {
1010

11-
private val schema: GraphQLSchema = SchemaParser.newParser().schemaString("""
11+
private val schema: GraphQLSchema = SchemaParser.newParser()
12+
.schemaString(
13+
"""
1214
type Query {
1315
itemByLongId(id: ID!): Item1!
1416
itemsByLongIds(ids: [ID!]!): [Item1!]!
@@ -17,19 +19,19 @@ class BuiltInIdTest {
1719
}
1820
1921
type Item1 {
20-
id: ID!
22+
id: ID!
2123
}
2224
2325
type Item2 {
24-
id: ID!
26+
id: ID!
2527
}
26-
""".trimIndent())
27-
.resolvers(QueryWithLongItemResolver())
28-
.build()
29-
.makeExecutableSchema()
28+
""")
29+
.resolvers(QueryWithLongItemResolver())
30+
.build()
31+
.makeExecutableSchema()
3032
private val gql: GraphQL = GraphQL.newGraphQL(schema)
31-
.queryExecutionStrategy(AsyncExecutionStrategy())
32-
.build()
33+
.queryExecutionStrategy(AsyncExecutionStrategy())
34+
.build()
3335

3436
@Test
3537
fun `supports Long as ID as input`() {
@@ -95,7 +97,6 @@ class BuiltInIdTest {
9597
assert(data["itemsByUuidIds"] != null)
9698
assert(((data["itemsByUuidIds"] as List<*>).size == 3))
9799
assert(((data["itemsByUuidIds"] as List<*>)[0] as Map<*, *>)["id"] == "00000000-0000-0000-0000-000000000000")
98-
99100
}
100101

101102
class QueryWithLongItemResolver : GraphQLQueryResolver {

src/test/kotlin/graphql/kickstart/tools/DirectiveTest.kt

Lines changed: 67 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -17,56 +17,59 @@ import java.util.function.BiFunction
1717
class DirectiveTest {
1818
@Test
1919
fun `should apply correctly the @uppercase directive`() {
20-
val schema = SchemaParser.newParser().schemaString("""
21-
directive @uppercase on FIELD_DEFINITION
22-
23-
type Query {
24-
users: UserConnection
25-
}
26-
27-
type UserConnection {
28-
edges: [UserEdge!]!
29-
}
30-
31-
type UserEdge {
32-
node: User!
33-
}
34-
35-
type User {
36-
id: ID!
37-
name: String @uppercase
38-
}
39-
""")
40-
.resolvers(UsersQueryResolver())
41-
.directive("uppercase", UppercaseDirective())
42-
.build()
43-
.makeExecutableSchema()
20+
val schema = SchemaParser.newParser()
21+
.schemaString(
22+
"""
23+
directive @uppercase on FIELD_DEFINITION
24+
25+
type Query {
26+
users: UserConnection
27+
}
28+
29+
type UserConnection {
30+
edges: [UserEdge!]!
31+
}
32+
33+
type UserEdge {
34+
node: User!
35+
}
36+
37+
type User {
38+
id: ID!
39+
name: String @uppercase
40+
}
41+
""")
42+
.resolvers(UsersQueryResolver())
43+
.directive("uppercase", UppercaseDirective())
44+
.build()
45+
.makeExecutableSchema()
4446

4547
val gql = GraphQL.newGraphQL(schema)
46-
.queryExecutionStrategy(AsyncExecutionStrategy())
47-
.build()
48-
49-
val result = gql.execute("""
50-
query {
51-
users {
52-
edges {
53-
node {
54-
id
55-
name
48+
.queryExecutionStrategy(AsyncExecutionStrategy())
49+
.build()
50+
51+
val result = gql.execute(
52+
"""
53+
query {
54+
users {
55+
edges {
56+
node {
57+
id
58+
name
59+
}
60+
}
5661
}
57-
}
5862
}
59-
}
60-
""")
63+
""")
6164

6265
val expected = mapOf(
63-
"users" to mapOf(
64-
"edges" to listOf(
65-
mapOf("node" to
66-
mapOf("id" to "1", "name" to "LUKE")
67-
)
68-
)
66+
"users" to mapOf(
67+
"edges" to listOf(
68+
mapOf("node" to
69+
mapOf("id" to "1", "name" to "LUKE")
70+
)
6971
)
72+
)
7073
)
7174

7275
Assert.assertEquals(expected, result.getData<Map<String, List<*>>>())
@@ -75,23 +78,25 @@ class DirectiveTest {
7578
@Test
7679
@Ignore("Ignore until enums work in directives")
7780
fun `should compile schema with directive that has enum parameter`() {
78-
val schema = SchemaParser.newParser().schemaString("""
79-
directive @allowed(state: [AllowedState!]) on FIELD_DEFINITION
80-
81-
enum AllowedState {
82-
ALLOWED
83-
DISALLOWED
84-
}
85-
86-
type Book {
87-
id: Int!
88-
name: String! @allowed(state: [ALLOWED])
89-
}
90-
91-
type Query {
92-
books: [Book!]
93-
}
94-
""")
81+
val schema = SchemaParser.newParser()
82+
.schemaString(
83+
"""
84+
directive @allowed(state: [AllowedState!]) on FIELD_DEFINITION
85+
86+
enum AllowedState {
87+
ALLOWED
88+
DISALLOWED
89+
}
90+
91+
type Book {
92+
id: Int!
93+
name: String! @allowed(state: [ALLOWED])
94+
}
95+
96+
type Query {
97+
books: [Book!]
98+
}
99+
""")
95100
.resolvers(QueryResolver())
96101
.directive("allowed", AllowedDirective())
97102
.build()
@@ -151,8 +156,8 @@ class DirectiveTest {
151156
}
152157

153158
private data class User(
154-
val id: Long,
155-
val name: String
159+
val id: Long,
160+
val name: String
156161
)
157162
}
158163
}

0 commit comments

Comments
 (0)