Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sort autocomplete results as order is not garanteed
Browse files Browse the repository at this point in the history
GromNaN committed Jan 8, 2025

Verified

This commit was signed with the committer’s verified signature.
GromNaN Jérôme Tamarelle
1 parent 6b05310 commit a5739e0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/AtlasSearchTest.php
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
use MongoDB\Laravel\Tests\Models\Book;

use function assert;
use function sort;
use function usleep;
use function usort;

@@ -193,10 +194,13 @@ public function testDatabaseBuilderAutocomplete()

self::assertInstanceOf(LaravelCollection::class, $results);
self::assertCount(3, $results);
// Sort results, because order is not guaranteed
$results = $results->all();
sort($results);
self::assertSame([
'Operating System Concepts',
'Database System Concepts',
'Modern Operating Systems',
], $results->all());
'Operating System Concepts',
], $results);
}
}

0 comments on commit a5739e0

Please sign in to comment.