Added test to cover code favourite pref. endpoint

This commit is contained in:
Dan Brown 2022-07-25 18:48:40 +01:00
parent 0df5ae0658
commit 7fdc7c68b9
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -3,6 +3,7 @@
namespace Tests\User;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Models\Page;
use Tests\TestCase;
class UserPreferencesTest extends TestCase
@ -150,4 +151,23 @@ class UserPreferencesTest extends TestCase
->assertElementExists('.featured-image-container')
->assertElementNotExists('.content-wrap .entity-list-item');
}
public function test_update_code_language_favourite()
{
$editor = $this->getEditor();
$page = Page::query()->first();
$this->actingAs($editor);
$this->patch('/settings/users/update-code-language-favourite', ['language' => 'php', 'active' => true]);
$this->patch('/settings/users/update-code-language-favourite', ['language' => 'javascript', 'active' => true]);
$resp = $this->get($page->getUrl('/edit'));
$resp->assertSee('option:code-editor:favourites="php,javascript"', false);
$this->patch('/settings/users/update-code-language-favourite', ['language' => 'ruby', 'active' => true]);
$this->patch('/settings/users/update-code-language-favourite', ['language' => 'php', 'active' => false]);
$resp = $this->get($page->getUrl('/edit'));
$resp->assertSee('option:code-editor:favourites="javascript,ruby"', false);
}
}