Skip to content

Commit

Permalink
Add explicit test for @enum directive
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Nov 7, 2024
1 parent 0fe0f92 commit be90c0a
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/Integration/Schema/Directives/EnumDirectiveTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php declare(strict_types=1);

namespace Tests\Integration\Schema\Directives;

use Tests\TestCase;

final class EnumDirectiveTest extends TestCase
{
public function testDefinesEnumWithInternalValues(): void
{
$this->mockResolver(function ($_, array $args): string {
$this->assertSame('Active internal', $args['status']);

return 'Not active';
});

$this->schema = /** @lang GraphQL */ '
enum Status {
ACTIVE @enum(value: "Active internal")
INACTIVE @enum(value: "Not active")
}
type Query {
status(status: Status!): Status! @mock
}
';

$this
->graphQL(/** @lang GraphQL */ '
{
status(status: ACTIVE)
}
')
->assertExactJson([
'data' => [
'status' => 'INACTIVE',
]
]);
}
}

0 comments on commit be90c0a

Please sign in to comment.