8000 [Tests] Add failing test for #370 · cloudcreativity/laravel-json-api@aa6192d · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit aa6192d

Browse files
committed
[Tests] Add failing test for #370
1 parent 52a4848 commit aa6192d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/dummy/tests/Feature/Avatars/CreateTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,22 @@ public function test(string $contentType): void
6666

6767
Storage::disk('local')->assertExists($path);
6868
}
69+
70+
public function testFileIsRequired(): void
71+
{
72+
$user = factory(User::class)->create();
73+
74+
/** @var TestResponse $response */
75+
$response = $this->actingAs($user, 'api')->post(
76+
'/api/v1/avatars',
77+
['avatar' => null],
78+
['Content-Type' => 'multipart/form-data', 'Content-Length' => '1']
79+
);
80+
81+
$response->assertExactErrorStatus([
82+
'title' => 'Unprocessable Entity',
83+
'status' => '422',
84+
'detail' => 'The avatar field is required.',
85+
]);
86+
}
6987
}

0 commit comments

Comments
 (0)
0