diff --git a/tests/Feature/ApiV2/CustomerTest.php b/tests/Feature/ApiV2/CustomerTest.php index bf144b4..fc7ba50 100644 --- a/tests/Feature/ApiV2/CustomerTest.php +++ b/tests/Feature/ApiV2/CustomerTest.php @@ -64,6 +64,32 @@ class CustomerTest extends ApiBase $this->assertNotEmpty($json->json('data.hashcode')); } + /** + * route: apiV2.customers.authenticate + */ + public function testApiAuthenticateCustomerShouldFail() + { + extract($this->getCustomer()); + $response = $this->callApiWithToken( + $service, + 'post', + route('apiV2.customers.authenticate', []), + [ + 'email' => $customer->email, + 'password' => 'testPasswords' + ] + ); + + $json = $response->decodeResponseJson(); + + $this->assertApiResponseStatusIs($json, ApiStatus::KO()); + $this->assertNotEmpty($json->json('data')); + $this->assertNotEmpty($json->json('data.message')); + $this->assertNotEmpty($json->json('data.code')); + $this->assertEquals(ApiError::authFailed()->value, $json->json('data.code')); + $this->assertEquals(ApiError::authFailed()->label, $json->json('data.message')); + } + /** * route: apiV2.customers.store */