Add type information to index
This commit is contained in:
parent
8609a648fd
commit
f16b58dbc6
|
@ -17,6 +17,9 @@ class FileshareConnectionResource extends JsonResource
|
|||
return [
|
||||
'name' => $this->name,
|
||||
'is_active' => $this->type->check(),
|
||||
'type' => get_class($this->type),
|
||||
'config' => $this->type->toArray(),
|
||||
'id' => $this->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,13 +11,18 @@ class ConnectionIndexActionTest extends FileshareTestCase
|
|||
public function testItListsOwncloudConnectionsThatAreActive(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami()->withOwncloudUser('badenpowell', 'secret');
|
||||
FileshareConnection::factory()
|
||||
$connection = FileshareConnection::factory()
|
||||
->type(OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')]))
|
||||
->name('lokaler Server')
|
||||
->create();
|
||||
|
||||
$this->get('/setting/fileshare')
|
||||
->assertInertiaPath('data.data.0.name', 'lokaler Server')
|
||||
->assertInertiaPath('data.data.0.type', OwncloudConnection::class)
|
||||
->assertInertiaPath('data.data.0.config.user', 'badenpowell')
|
||||
->assertInertiaPath('data.data.0.config.password', 'secret')
|
||||
->assertInertiaPath('data.data.0.config.base_url', env('TEST_OWNCLOUD_DOMAIN'))
|
||||
->assertInertiaPath('data.data.0.id', $connection->id)
|
||||
->assertInertiaPath('data.data.0.is_active', true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue