feat: source tokens and client events API

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
This commit is contained in:
nikita.hohlov
2026-09-04 06:58:03 -03:00
parent 245ca88af6
commit 5ea5c045a7
9 changed files with 387 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace Tests\Feature;
use App\Models\Source;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class SourceCreateCommandTest extends TestCase
{
use RefreshDatabase;
public function test_creates_source_and_prints_token_once(): void
{
$this->artisan('hado:source:create', ['name' => 'docs'])
->expectsOutputToContain('Token: hado_')
->assertSuccessful();
$source = Source::where('name', 'docs')->sole();
$this->assertSame(64, strlen($source->token_hash));
}
public function test_refuses_duplicate_name(): void
{
Source::create(['name' => 'docs', 'token_hash' => hash('sha256', 'x')]);
$this->artisan('hado:source:create', ['name' => 'docs'])->assertFailed();
}
}