Skip to content

Commit

Permalink
Add contentNodes test
Browse files Browse the repository at this point in the history
  • Loading branch information
esamattis committed Jan 27, 2020
1 parent 8c68b20 commit fa71e2a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/wpunit/PostObjectQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,29 @@ public function testCanFetchSingleTranslatedVersion()

$this->assertEquals($expected, $data['data']['postBy']);
}

public function testContentNodesFiltering()
{
$query = '
query Posts {
contentNodes(where: {language: FI}) {
nodes {
... on Post {
title
}
}
}
}
';

$data = do_graphql_request($query);
$nodes = $data['data']['contentNodes']['nodes'] ?? [];
$expected = [
[
'title' => 'Finnish post'
]
];

$this->assertEquals($nodes, $expected);
}
}

0 comments on commit fa71e2a

Please sign in to comment.