Separated laravel app to its own folder (#540)
This commit is contained in:
36
api/tests/Feature/WorkspaceTest.php
Normal file
36
api/tests/Feature/WorkspaceTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
it('can create and delete Workspace', function () {
|
||||
$user = $this->actingAsUser();
|
||||
|
||||
for ($i = 1; $i <= 3; $i++) {
|
||||
$this->postJson(route('open.workspaces.create'), [
|
||||
'name' => 'Workspace Test - '.$i,
|
||||
'icon' => '🧪',
|
||||
])
|
||||
->assertSuccessful()
|
||||
->assertJson([
|
||||
'type' => 'success',
|
||||
'message' => 'Workspace created.',
|
||||
]);
|
||||
}
|
||||
|
||||
expect($user->workspaces()->count())->toBe(3);
|
||||
|
||||
$i = 0;
|
||||
foreach ($user->workspaces as $workspace) {
|
||||
$i++;
|
||||
if ($i !== 3) {
|
||||
$this->deleteJson(route('open.workspaces.delete', $workspace->id))
|
||||
->assertSuccessful()
|
||||
->assertJson([
|
||||
'type' => 'success',
|
||||
'message' => 'Workspace deleted.',
|
||||
]);
|
||||
} else {
|
||||
// Last workspace can not delete
|
||||
$this->deleteJson(route('open.workspaces.delete', $workspace->id))
|
||||
->assertStatus(403);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user