Skip to content

Commit

Permalink
test(search): add tests on search decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasalexandre9 committed Jan 6, 2025
1 parent 769bd7c commit fab4fde
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
beforeEach(function () {
$datasource = new Datasource();
$collectionPerson = new Collection($datasource, 'Person');
$collectionPerson->addFields(
['id' => new ColumnSchema(columnType: PrimitiveType::NUMBER, filterOperators: [Operators::IN, Operators::EQUAL], isPrimaryKey: true)]
);
$datasource->addCollection($collectionPerson);
$this->buildAgent($datasource);

Expand All @@ -43,6 +46,16 @@
expect($this->invokeProperty($searchCollection, 'replacer'))->toEqual($replace);
});

test('disableSearchable() should set false the disabledSearch attribute', function () {
[$datasource, $collection] = $this->bucket;
$searchCollection = new SearchCollection($collection, $datasource);

expect($searchCollection->isSearchable())->toBeTrue();
$searchCollection->disableSearch();
expect($searchCollection->isSearchable())->toBeFalse();
});


test('isSearchable() should return true', function () {
[$datasource, $collection] = $this->bucket;
$searchCollection = new SearchCollection($collection, $datasource);
Expand Down

0 comments on commit fab4fde

Please sign in to comment.