Files
einundzwanzig-app/tests/Feature/ServiceDisclaimerTest.php
T
HolgerHatGarKeineNode 4c9dec42f2 Add service disclaimer component and Nostr validation links
-  Introduced reusable `<x-service-disclaimer>` component for better clarity and consistency on service pages.
- 🔗 Added `njump` links for Nostr profile validation in service listings and landing pages.
- 🧪 Included feature tests to verify disclaimer visibility and correct `njump` link rendering or omission for anonymous services.
2026-06-25 14:12:21 +02:00

39 lines
1.3 KiB
PHP

<?php
use App\Models\SelfHostedService;
use App\Models\User;
it('shows the disclaimer and njump link on the services index', function () {
SelfHostedService::factory()->for(
User::factory()->create(['nostr' => 'npub1example']),
'createdBy'
)->create();
$this->get(route('services.index', ['country' => 'de']))
->assertOk()
->assertSee('Keine Empfehlung von EINUNDZWANZIG')
->assertSee('npub')
->assertSee('https://njump.me/npub1example');
});
it('shows the disclaimer and njump link on the service landingpage', function () {
$service = SelfHostedService::factory()->for(
User::factory()->create(['nostr' => 'npub1example']),
'createdBy'
)->create();
$this->get(route('services.landingpage', ['country' => 'de', 'service' => $service->slug]))
->assertOk()
->assertSee('Keine Empfehlung von EINUNDZWANZIG')
->assertSee('https://njump.me/npub1example');
});
it('omits the njump link for anonymous services', function () {
$service = SelfHostedService::factory()->anonymous()->create();
$this->get(route('services.landingpage', ['country' => 'de', 'service' => $service->slug]))
->assertOk()
->assertSee('Keine Empfehlung von EINUNDZWANZIG')
->assertDontSee('njump.me');
});