Files
laravel-manager/tests/Feature/PulseScriptTest.php
T
Matthijs Iriks 5c0a94f167
PR CI / ledger (pull_request) Successful in 4s
PR CI / flow (pull_request) Successful in 4s
PR CI / ui (pull_request) Successful in 18s
PR CI / test (lowest) (pull_request) Successful in 39s
PR CI / security (pull_request) Successful in 49s
PR CI / test (stable) (pull_request) Successful in 51s
PR CI / pr-ci (pull_request) Successful in 2s
PR CI / release-automerge (pull_request) Successful in 3s
Add the pulse script and the component for the public pages
2026-12-04 05:35:30 +01:00

22 lines
857 B
PHP

<?php
use Illuminate\Support\Facades\Blade;
use IriksIT\Manager\Tests\StatisticsOnTestCase;
uses(StatisticsOnTestCase::class);
it('serves the script for the public pages, without cookies or a session', function () {
$response = $this->get('/pulse/pulse.js')->assertOk()->assertHeader('Content-Type', 'application/javascript');
$script = $response->getFile()->getContent();
expect($script)->toContain('/view', '/leave', 'doNotTrack', 'globalPrivacyControl', "credentials: 'omit'")
->and($response->headers->get('Set-Cookie'))->toBeNull();
});
it('has a component that puts the script in a page', function () {
$html = Blade::render('<x-manager::pulse />');
expect(trim($html))->toBe('<script src="/pulse/pulse.js" defer ></script>');
expect(Blade::render('<x-manager::pulse :spa="true" />'))->toContain('data-spa');
});