get(route('documentation.index')) ->assertOk() ->assertInertia( fn (AssertableInertia $page) => $page ->component('documentation/show') ->where('document.slug', 'getting-started') ->where('document.locale', 'en') ->where('document.title', 'Getting started') ->where('document.description', 'Learn the basic Whisper Money workflow.') ->where('navigation.0.active', true) ->where('languages.0.active', true) ->where('languages.1.url', '/documentation/getting-started?lang=es') ); }); it('shows every configured documentation page in every locale', function () { $pages = array_keys(config('documentation.pages')); $locales = array_keys(config('documentation.locales')); foreach ($pages as $slug) { foreach ($locales as $locale) { $this->get(route('documentation.show', ['slug' => $slug, 'lang' => $locale])) ->assertOk() ->assertInertia( fn (AssertableInertia $page) => $page ->component('documentation/show') ->where('document.slug', $slug) ->where('document.locale', $locale) ); } } }); it('shows the English categories documentation page', function () { $this->get(route('documentation.show', ['slug' => 'categories', 'lang' => 'en'])) ->assertOk() ->assertInertia( fn (AssertableInertia $page) => $page ->component('documentation/show') ->where('document.slug', 'categories') ->where('document.locale', 'en') ->where('document.title', 'Categories') ); }); it('shows the Spanish categories documentation page', function () { $this->get(route('documentation.show', ['slug' => 'categories', 'lang' => 'es'])) ->assertOk() ->assertInertia( fn (AssertableInertia $page) => $page ->component('documentation/show') ->where('document.slug', 'categories') ->where('document.locale', 'es') ->where('document.title', 'Categorías') ->where('document.description', 'Aprende cómo funcionan las categorías en Whisper Money.') ->where('languages.0.url', '/documentation/categories?lang=en') ->where('languages.1.active', true) ->where('document.html', fn (string $html): bool => str_contains($html, 'Mapa de categorías') && str_contains($html, 'href="#mapa-de-categorias"') && str_contains($html, '

En esta página

')) ); }); it('replaces the table of contents placeholder with heading links', function () { $this->get(route('documentation.show', ['slug' => 'categories', 'lang' => 'en'])) ->assertOk() ->assertInertia( fn (AssertableInertia $page) => $page ->where('document.html', fn (string $html): bool => ! str_contains($html, '{{TOC}}') && str_contains($html, '