Skip to content

Commit

Permalink
Add wp-graphiql test
Browse files Browse the repository at this point in the history
  • Loading branch information
esamattis committed Dec 11, 2019
1 parent 91a2684 commit 961547b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/functional/BasicCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,37 @@ public function testCanSendPOST( FunctionalTester $I ) {
]);

}

/**
* wp-graphql sends graphql requests to index.php?graphql
*/
public function testCanSendPOSTToGraphiql( FunctionalTester $I ) {

$query = '
{
languages {
code
}
}';

$I->haveHttpHeader( 'Content-Type', 'application/json' );
$I->sendPOST( '/index.php?graphql', [
'query' => $query,
] );
$I->seeResponseCodeIs( 200 );
$I->seeResponseIsJson();
$I->seeResponseContainsJson([
'data' => [
'languages' => [
[
'code' => 'EN',
],
[
'code' => 'FI',
]
],
],
]);

}
}

0 comments on commit 961547b

Please sign in to comment.