Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed May 28, 2024
1 parent cf3bd44 commit bd40b9c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/Feature/GraphQL/TermsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,40 @@ public function it_queries_all_terms()
]]]]);
}

/** @test */
public function it_queries_all_terms_in_a_specific_site()
{
$this->createTaxonomies()->createTerms()->createBlueprints();

$this->setSites([
'en' => ['url' => 'http://localhost/', 'locale' => 'en'],
'fr' => ['url' => 'http://localhost/fr/', 'locale' => 'fr'],
]);

Taxonomy::find('tags')->sites(['en', 'fr'])->save();

Term::find('tags::alpha')->in('fr')->data(['title' => 'Le Alpha'])->save();

$query = <<<'GQL'
{
terms(site: "fr") {
data {
id
title
}
}
}
GQL;

$this
->withoutExceptionHandling()
->post('/graphql', ['query' => $query])
->assertGqlOk()
->assertExactJson(['data' => ['terms' => ['data' => [
['id' => 'tags::alpha', 'title' => 'Le Alpha'],
]]]]);
}

/** @test */
public function it_queries_only_terms_on_allowed_sub_resources()
{
Expand Down

0 comments on commit bd40b9c

Please sign in to comment.