1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-22 02:42:29 +01:00

Testing: Improved reliability

- Added extra column/value check for page revision test for accuracy.
- Changed search sort test to use more reliable values.
  - Change due to database seeding somtimes generating values that
    proceeded the test value, expected to be first, in sort results.
This commit is contained in:
Dan Brown 2024-11-08 11:35:18 +00:00
parent 7017a1cae5
commit a6ba8dd68f
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
2 changed files with 5 additions and 4 deletions

View File

@ -102,6 +102,7 @@ class UpdateUrlCommandTest extends TestCase
setting()->flushCache();
$this->assertDatabaseHas('page_revisions', [
'page_id' => $page->id,
'markdown' => '[A link 1](https://cats.example.com/donkey/cat)',
'html' => '<p id="bkmrk-a-link-1"><a href="https://cats.example.com/donkey/cat">A link 1</a></p>' . "\n"
]);

View File

@ -393,11 +393,11 @@ class EntitySearchTest extends TestCase
$search = $this->actingAs($this->users->viewer())->get("/search/entity/siblings?entity_id={$contextBook->id}&entity_type=book");
$this->withHtml($search)->assertElementNotContains('a:first-child', 'Zebras');
$searchBook->name = 'AAAAAAArdvarks';
$searchBook->name = '1AAAAAAArdvarks';
$searchBook->save();
$search = $this->actingAs($this->users->viewer())->get("/search/entity/siblings?entity_id={$contextBook->id}&entity_type=book");
$this->withHtml($search)->assertElementContains('a:first-child', 'AAAAAAArdvarks');
$this->withHtml($search)->assertElementContains('a:first-child', '1AAAAAAArdvarks');
}
public function test_sibling_search_for_shelves_provides_results_in_alphabetical_order()
@ -411,11 +411,11 @@ class EntitySearchTest extends TestCase
$search = $this->actingAs($this->users->viewer())->get("/search/entity/siblings?entity_id={$contextShelf->id}&entity_type=bookshelf");
$this->withHtml($search)->assertElementNotContains('a:first-child', 'Zebras');
$searchShelf->name = 'AAAAAAArdvarks';
$searchShelf->name = '1AAAAAAArdvarks';
$searchShelf->save();
$search = $this->actingAs($this->users->viewer())->get("/search/entity/siblings?entity_id={$contextShelf->id}&entity_type=bookshelf");
$this->withHtml($search)->assertElementContains('a:first-child', 'AAAAAAArdvarks');
$this->withHtml($search)->assertElementContains('a:first-child', '1AAAAAAArdvarks');
}
public function test_search_works_on_updated_page_content()