mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-29 08:26:02 +03:00
17520876d8
This includes: graphql/graphql-js#1147 graphql/graphql-js#355 This also fixes two bugs in the Schema - types that were not found where still added to the typeMap - InputObject args should not be searched for types.
46 lines
1016 B
PHP
46 lines
1016 B
PHP
<?php
|
|
namespace GraphQL\Tests\Utils;
|
|
|
|
use GraphQL\Executor\Values;
|
|
use GraphQL\Type\Definition\Type;
|
|
use GraphQL\Utils\Utils;
|
|
use GraphQL\Utils\Value;
|
|
|
|
class SuggestionListTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
// DESCRIBE: suggestionList
|
|
|
|
/**
|
|
* @it Returns results when input is empty
|
|
*/
|
|
public function testResturnsResultsWhenInputIsEmpty()
|
|
{
|
|
$this->assertEquals(
|
|
Utils::suggestionList('', ['a']),
|
|
['a']
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @it Returns empty array when there are no options
|
|
*/
|
|
public function testReturnsEmptyArrayWhenThereAreNoOptions()
|
|
{
|
|
$this->assertEquals(
|
|
Utils::suggestionList('input', []),
|
|
[]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @it Returns options sorted based on similarity
|
|
*/
|
|
public function testReturnsOptionsSortedBasedOnSimilarity()
|
|
{
|
|
$this->assertEquals(
|
|
Utils::suggestionList('abc', ['a', 'ab', 'abc']),
|
|
['abc', 'ab']
|
|
);
|
|
}
|
|
}
|