feat: add SocialAccount model, migration, and factory
Implement SocialAccount model with enum fields for network and type, along with migration and factory. Includes NETWORKS and TYPES constants for dropdown usage in Livewire forms and validation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
889ac9b7f9
commit
137a15f5ff
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use App\Models\SocialAccount;
|
||||
|
||||
test('a social account can be created with all required fields and a type', function () {
|
||||
$account = SocialAccount::create([
|
||||
'network' => 'twitter',
|
||||
'username' => 'my_handle',
|
||||
'email' => 'handle@example.com',
|
||||
'password' => 'plain-text-password',
|
||||
'type' => 'post',
|
||||
]);
|
||||
|
||||
expect($account->fresh())
|
||||
->network->toBe('twitter')
|
||||
->username->toBe('my_handle')
|
||||
->email->toBe('handle@example.com')
|
||||
->password->toBe('plain-text-password')
|
||||
->type->toBe('post');
|
||||
});
|
||||
|
||||
test('a social account can be created with a null type', function () {
|
||||
$account = SocialAccount::create([
|
||||
'network' => 'instagram',
|
||||
'username' => 'my_handle',
|
||||
'email' => 'handle@example.com',
|
||||
'password' => 'plain-text-password',
|
||||
]);
|
||||
|
||||
expect($account->fresh()->type)->toBeNull();
|
||||
});
|
||||
Reference in New Issue
Block a user