Skip to content

Commit 460043f

Browse files
author
Cyril Mizzi
committed
fix(tests): update unit tests
ref #25
1 parent 41ed401 commit 460043f

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

tests/GraphQLMutationTest.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,20 @@ public function testMutation() {
3838
$this->specify('tests validation', function () {
3939
$query = 'mutation { user(id: 1, with: { name: "la" }) { id, name } }';
4040
$this->assertGraphQLEquals($query, [
41-
'data' => [
42-
'user' => null
43-
],
4441
'errors' => [
4542
[
4643
'message' => 'validation',
47-
'locations' => [
48-
[
49-
'line' => 1,
50-
'column' => 12,
51-
],
52-
],
44+
'category' => 'graphql',
5345
'validation' => [
5446
'name' => [
5547
'The name must be between 3 and 10 characters.'
5648
]
5749
]
5850
]
59-
]
51+
],
52+
'data' => [
53+
'user' => null
54+
],
6055
]);
6156
});
6257

@@ -408,8 +403,7 @@ public function testMutationCustomInputFieldException() {
408403
. ' name_uppercase: "badvalue" }) { id, name } }';
409404

410405
$data = $this->executeGraphQL($query);
411-
412-
$this->assertSame("it's a bad value", $data['errors'][0]['message']);
406+
$this->assertSame("Internal server error", $data['errors'][0]['message']);
413407
});
414408
}
415409
}

tests/GraphQLTest.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,15 @@ public function testAuthorizeChecking() {
175175
$query = 'query { unauthorized }';
176176

177177
$this->assertGraphQLEquals($query, [
178-
'data' => [
179-
'unauthorized' => null
180-
],
181178
'errors' => [
182179
[
183180
'message' => 'UNAUTHORIZED',
184-
'locations' => [
185-
[
186-
'line' => 1,
187-
'column' => 9
188-
]
189-
]
181+
'category' => 'graphql'
190182
]
191-
]
183+
],
184+
'data' => [
185+
'unauthorized' => null
186+
],
192187
]);
193188
});
194189
}

0 commit comments

Comments
 (0)