Skip to content

Commit

Permalink
Added tests for homepage parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nahime0 committed Apr 25, 2023
1 parent 5652331 commit e699f8f
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 136 deletions.
48 changes: 25 additions & 23 deletions tests/Feature/LoggedIn/AllEnabledTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,37 @@ function () {
/**
* All routes are available
*/
it('routes to dashboard', fn() => $this->routes->toDashboard());
it('routes to login', fn() => $this->routes->toLogin());
it('routes to logout', fn() => $this->routes->toLogout());
it('routes to register', fn() => $this->routes->toRegister());
it('routes to password confirm', fn() => $this->routes->toPasswordConfirm());
it('routes to password request', fn() => $this->routes->toPasswordRequest());
it('routes to password email', fn() => $this->routes->toPasswordEmail());
it('routes to password update', fn() => $this->routes->toPasswordUpdate());
it('routes to password store', fn() => $this->routes->toPasswordStore());
it('routes to password reset', fn() => $this->routes->toPasswordReset());
it('routes to profile edit', fn() => $this->routes->toProfileEdit());
it('routes to profile update', fn() => $this->routes->toProfileUpdate());
it('routes to profile destroy', fn() => $this->routes->toProfileDestroy());
it('routes to verification send', fn() => $this->routes->toVerificationSend());
it('routes to verification notice', fn() => $this->routes->toVerificationNotice());
it('routes to verification verify', fn() => $this->routes->toVerificationVerify());
it('routes to dashboard', fn() => $this->routes->toDashboard());
it('routes to homepage', fn() => $this->routes->toHomepage());
it('routes to login', fn() => $this->routes->toLogin());
it('routes to logout', fn() => $this->routes->toLogout());
it('routes to register', fn() => $this->routes->toRegister());
it('routes to password confirm', fn() => $this->routes->toPasswordConfirm());
it('routes to password request', fn() => $this->routes->toPasswordRequest());
it('routes to password email', fn() => $this->routes->toPasswordEmail());
it('routes to password update', fn() => $this->routes->toPasswordUpdate());
it('routes to password store', fn() => $this->routes->toPasswordStore());
it('routes to password reset', fn() => $this->routes->toPasswordReset());
it('routes to profile edit', fn() => $this->routes->toProfileEdit());
it('routes to profile update', fn() => $this->routes->toProfileUpdate());
it('routes to profile destroy', fn() => $this->routes->toProfileDestroy());
it('routes to verification send', fn() => $this->routes->toVerificationSend());
it('routes to verification notice', fn() => $this->routes->toVerificationNotice());
it('routes to verification verify', fn() => $this->routes->toVerificationVerify());

/**
* Redirects the authenticated user to the dashboard
*/
it('redirects login to dashboard', fn() => $this->redirects->loginToDashboard());
it('redirects register to dashboard', fn() => $this->redirects->registerToDashboard());
it('redirects verification notice to dashboard', fn() => $this->redirects->verificatioNoticeToDashboard());
it('redirects forgot password to dashboard', fn() => $this->redirects->forgotPasswordToDashboard());
it('redirects reset password to dashboard', fn() => $this->redirects->resetPasswordToDashboard());
it('redirects login to dashboard', fn() => $this->redirects->loginToDashboard());
it('redirects register to dashboard', fn() => $this->redirects->registerToDashboard());
it('redirects verification notice to dashboard', fn() => $this->redirects->verificatioNoticeToDashboard());
it('redirects forgot password to dashboard', fn() => $this->redirects->forgotPasswordToDashboard());
it('redirects reset password to dashboard', fn() => $this->redirects->resetPasswordToDashboard());

/**
* Exposes the correct functionalities
*/
it('exposes homepage', fn() => $this->exposes->homepage());
it('exposes dashboard', fn() => $this->exposes->dashboard());
it('exposes error on verification verify', fn() => $this->exposes->errorPageOnVerificationVerify());
it('exposes dashboard', fn() => $this->exposes->dashboard());
it('exposes profile', fn() => $this->exposes->profile());
it('exposes profile', fn() => $this->exposes->profile());
46 changes: 24 additions & 22 deletions tests/Feature/LoggedIn/DisabledUserProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,39 @@ function () {
/**
* All routes are available
*/
it('routes to dashboard', fn() => $this->routes->toDashboard());
it('routes to login', fn() => $this->routes->toLogin());
it('routes to logout', fn() => $this->routes->toLogout());
it('routes to register', fn() => $this->routes->toRegister());
it('routes to password confirm', fn() => $this->routes->toPasswordConfirm());
it('routes to password request', fn() => $this->routes->toPasswordRequest());
it('routes to password email', fn() => $this->routes->toPasswordEmail());
it('routes to password update', fn() => $this->routes->toPasswordUpdate());
it('routes to password store', fn() => $this->routes->toPasswordStore());
it('routes to password reset', fn() => $this->routes->toPasswordReset());
it('routes to profile edit', fn() => $this->routes->toProfileEdit());
it('routes to profile update', fn() => $this->routes->toProfileUpdate());
it('routes to profile destroy', fn() => $this->routes->toProfileDestroy());
it('routes to verification send', fn() => $this->routes->toVerificationSend());
it('routes to verification notice', fn() => $this->routes->toVerificationNotice());
it('routes to verification verify', fn() => $this->routes->toVerificationVerify());
it('routes to dashboard', fn() => $this->routes->toDashboard());
it('routes to homepage', fn() => $this->routes->toHomepage());
it('routes to login', fn() => $this->routes->toLogin());
it('routes to logout', fn() => $this->routes->toLogout());
it('routes to register', fn() => $this->routes->toRegister());
it('routes to password confirm', fn() => $this->routes->toPasswordConfirm());
it('routes to password request', fn() => $this->routes->toPasswordRequest());
it('routes to password email', fn() => $this->routes->toPasswordEmail());
it('routes to password update', fn() => $this->routes->toPasswordUpdate());
it('routes to password store', fn() => $this->routes->toPasswordStore());
it('routes to password reset', fn() => $this->routes->toPasswordReset());
it('routes to profile edit', fn() => $this->routes->toProfileEdit());
it('routes to profile update', fn() => $this->routes->toProfileUpdate());
it('routes to profile destroy', fn() => $this->routes->toProfileDestroy());
it('routes to verification send', fn() => $this->routes->toVerificationSend());
it('routes to verification notice', fn() => $this->routes->toVerificationNotice());
it('routes to verification verify', fn() => $this->routes->toVerificationVerify());

/**
* Redirects the authenticated user to the dashboard
*/
it('redirects login to dashboard', fn() => $this->redirects->loginToDashboard());
it('redirects register to dashboard', fn() => $this->redirects->registerToDashboard());
it('redirects verification notice to dashboard', fn() => $this->redirects->verificatioNoticeToDashboard());
it('redirects forgot password to dashboard', fn() => $this->redirects->forgotPasswordToDashboard());
it('redirects reset password to dashboard', fn() => $this->redirects->resetPasswordToDashboard());
it('redirects login to dashboard', fn() => $this->redirects->loginToDashboard());
it('redirects register to dashboard', fn() => $this->redirects->registerToDashboard());
it('redirects verification notice to dashboard', fn() => $this->redirects->verificatioNoticeToDashboard());
it('redirects forgot password to dashboard', fn() => $this->redirects->forgotPasswordToDashboard());
it('redirects reset password to dashboard', fn() => $this->redirects->resetPasswordToDashboard());

/**
* Exposes the correct functionalities
*/
it('exposes homepage', fn() => $this->exposes->homepage());
it('exposes dashboard', fn() => $this->exposes->dashboard());
it('exposes error on verification verify', fn() => $this->exposes->errorPageOnVerificationVerify());
it('exposes dashboard', fn() => $this->exposes->dashboard());

/**
* Hides profile without user profile enabled
Expand Down
54 changes: 28 additions & 26 deletions tests/Feature/LoggedOut/AllEnabledTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,44 @@ function () {
}
);

it('routes to dashboard', fn() => $this->routes->toDashboard());
it('routes to login', fn() => $this->routes->toLogin());
it('routes to logout', fn() => $this->routes->toLogout());
it('routes to register', fn() => $this->routes->toRegister());
it('routes to password confirm', fn() => $this->routes->toPasswordConfirm());
it('routes to password request', fn() => $this->routes->toPasswordRequest());
it('routes to password email', fn() => $this->routes->toPasswordEmail());
it('routes to password update', fn() => $this->routes->toPasswordUpdate());
it('routes to password store', fn() => $this->routes->toPasswordStore());
it('routes to password reset', fn() => $this->routes->toPasswordReset());
it('routes to profile edit', fn() => $this->routes->toProfileEdit());
it('routes to profile update', fn() => $this->routes->toProfileUpdate());
it('routes to profile destroy', fn() => $this->routes->toProfileDestroy());
it('routes to verification send', fn() => $this->routes->toVerificationSend());
it('routes to verification notice', fn() => $this->routes->toVerificationNotice());
it('routes to verification verify', fn() => $this->routes->toVerificationVerify());
it('routes to dashboard', fn() => $this->routes->toDashboard());
it('routes to homepage', fn() => $this->routes->toHomepage());
it('routes to login', fn() => $this->routes->toLogin());
it('routes to logout', fn() => $this->routes->toLogout());
it('routes to register', fn() => $this->routes->toRegister());
it('routes to password confirm', fn() => $this->routes->toPasswordConfirm());
it('routes to password request', fn() => $this->routes->toPasswordRequest());
it('routes to password email', fn() => $this->routes->toPasswordEmail());
it('routes to password update', fn() => $this->routes->toPasswordUpdate());
it('routes to password store', fn() => $this->routes->toPasswordStore());
it('routes to password reset', fn() => $this->routes->toPasswordReset());
it('routes to profile edit', fn() => $this->routes->toProfileEdit());
it('routes to profile update', fn() => $this->routes->toProfileUpdate());
it('routes to profile destroy', fn() => $this->routes->toProfileDestroy());
it('routes to verification send', fn() => $this->routes->toVerificationSend());
it('routes to verification notice', fn() => $this->routes->toVerificationNotice());
it('routes to verification verify', fn() => $this->routes->toVerificationVerify());

/**
* Check that the login, register, forgot password and reset password are available
*/
it('exposes login', fn() => $this->exposes->login());
it('exposes register', fn() => $this->exposes->register());
it('exposes forgot password', fn() => $this->exposes->forgotPassword());
it('exposes reset password', fn() => $this->exposes->resetPassword());
it('exposes homepage', fn() => $this->exposes->homepage());
it('exposes login', fn() => $this->exposes->login());
it('exposes register', fn() => $this->exposes->register());
it('exposes forgot password', fn() => $this->exposes->forgotPassword());
it('exposes reset password', fn() => $this->exposes->resetPassword());

/**
* Has the correct links in the various views
*/
it('has register in login', fn() => $this->has->registerInLogin());
it('has register in login', fn() => $this->has->registerInLogin());
it('has password request in login', fn() => $this->has->passwordRequestInLogin());
it('has login in register', fn() => $this->has->loginInRegister());
it('has login in register', fn() => $this->has->loginInRegister());

/**
* Correcly redirects to login protected routes
*/
it('redirects dashboard to login', fn() => $this->redirects->dashboardToLogin());
it('redirects verification notice to login', fn() => $this->redirects->verificatioNoticeToLogin());
it('redirects verification verify to login', fn() => $this->redirects->verificationVerifyToLogin());
it('redirects profile to login', fn() => $this->redirects->profileToLogin());
it('redirects dashboard to login', fn() => $this->redirects->dashboardToLogin());
it('redirects verification notice to login', fn() => $this->redirects->verificatioNoticeToLogin());
it('redirects verification verify to login', fn() => $this->redirects->verificationVerifyToLogin());
it('redirects profile to login', fn() => $this->redirects->profileToLogin());
22 changes: 12 additions & 10 deletions tests/Feature/LoggedOut/DisabledForgotPasswordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function () {
);

it('routes to dashboard', fn() => $this->routes->toDashboard());
it('routes to homepage', fn() => $this->routes->toHomepage());
it('routes to login', fn() => $this->routes->toLogin());
it('routes to logout', fn() => $this->routes->toLogout());
it('routes to register', fn() => $this->routes->toRegister());
Expand All @@ -34,20 +35,21 @@ function () {
/**
* Check that the login, register are available
*/
it('exposes login', fn() => $this->exposes->login());
it('exposes register', fn() => $this->exposes->register());
it('exposes homepage', fn() => $this->exposes->homepage());
it('exposes login', fn() => $this->exposes->login());
it('exposes register', fn() => $this->exposes->register());

/**
* Hides forgot and reset password
*/
it('hides forgot password', fn() => $this->hides->forgotPassword());
it('hides reset password', fn() => $this->hides->resetPassword());
it('hides forgot password', fn() => $this->hides->forgotPassword());
it('hides reset password', fn() => $this->hides->resetPassword());

/**
* Has the correct links in the various views
*/
it('has register in login', fn() => $this->has->registerInLogin());
it('has login in register', fn() => $this->has->loginInRegister());
it('has register in login', fn() => $this->has->registerInLogin());
it('has login in register', fn() => $this->has->loginInRegister());

/**
* Hasn't the link to forgot password in the login
Expand All @@ -58,7 +60,7 @@ function () {
/**
* Correcly redirects to login protected routes
*/
it('redirects dashboard to login', fn() => $this->redirects->dashboardToLogin());
it('redirects verification notice to login', fn() => $this->redirects->verificatioNoticeToLogin());
it('redirects verification verify to login', fn() => $this->redirects->verificationVerifyToLogin());
it('redirects profile to login', fn() => $this->redirects->profileToLogin());
it('redirects dashboard to login', fn() => $this->redirects->dashboardToLogin());
it('redirects verification notice to login', fn() => $this->redirects->verificatioNoticeToLogin());
it('redirects verification verify to login', fn() => $this->redirects->verificationVerifyToLogin());
it('redirects profile to login', fn() => $this->redirects->profileToLogin());
4 changes: 3 additions & 1 deletion tests/Feature/LoggedOut/DisabledRegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function () {
);

it('routes to dashboard', fn() => $this->routes->toDashboard());
it('routes to homepage', fn() => $this->routes->toHomepage());
it('routes to login', fn() => $this->routes->toLogin());
it('routes to logout', fn() => $this->routes->toLogout());
it('routes to register', fn() => $this->routes->toRegister());
Expand All @@ -34,6 +35,7 @@ function () {
/**
* Check that the login, forgot password and reset password are available
*/
it('exposes homepage', fn() => $this->exposes->homepage());
it('exposes login', fn() => $this->exposes->login());
it('exposes forgot password', fn() => $this->exposes->forgotPassword());
it('exposes reset password', fn() => $this->exposes->resetPassword());
Expand All @@ -59,4 +61,4 @@ function () {
it('redirects dashboard to login', fn() => $this->redirects->dashboardToLogin());
it('redirects verification notice to login', fn() => $this->redirects->verificatioNoticeToLogin());
it('redirects verification verify to login', fn() => $this->redirects->verificationVerifyToLogin());
it('redirects profile to login', fn() => $this->redirects->profileToLogin());
it('redirects profile to login', fn() => $this->redirects->profileToLogin());
Loading

0 comments on commit e699f8f

Please sign in to comment.