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:
29
core/tests/Feature/SourceCreateCommandTest.php
Normal file
29
core/tests/Feature/SourceCreateCommandTest.php
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user