-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bruno
committed
Feb 16, 2024
1 parent
4937cd1
commit c810a79
Showing
7 changed files
with
38 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package controllers_test | |
|
||
import ( | ||
"net/http" | ||
"os" | ||
"testing" | ||
|
||
"github.com/gavv/httpexpect/v2" | ||
|
@@ -66,10 +67,13 @@ func (suite *AuthenticateVoterControllerTestSuite) SetupTest() { | |
|
||
func TestAuthenticateVoterControllerSuite(t *testing.T) { | ||
// Register the test suite | ||
if os.Getenv("IGNORE_E2E") != "" { | ||
t.Skip("Ignorando testes E2E") | ||
} | ||
suite.Run(t, new(AuthenticateVoterControllerTestSuite)) | ||
} | ||
|
||
func (suite *AuthenticateVoterControllerTestSuite) TestHandle() { | ||
func (suite *AuthenticateVoterControllerTestSuite) TestE2EHandle() { | ||
suite.Run("should return 200 if voter was authenticated", func() { | ||
password, _ := di.GetContainer().Get("hasher").(*cryptography.BCryptHasher).Hash("123456") | ||
|
||
|
@@ -84,7 +88,7 @@ func (suite *AuthenticateVoterControllerTestSuite) TestHandle() { | |
}) | ||
} | ||
|
||
func (suite *AuthenticateVoterControllerTestSuite) TestHandleInvalidData() { | ||
func (suite *AuthenticateVoterControllerTestSuite) TestE2EHandleInvalidData() { | ||
suite.Run("should return 400 if voter data is not valid", func() { | ||
suite.e.POST("/auth/register").WithJSON(map[string]interface{}{ | ||
"email": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package controllers_test | |
|
||
import ( | ||
"net/http" | ||
"os" | ||
"testing" | ||
|
||
"github.com/gavv/httpexpect/v2" | ||
|
@@ -71,10 +72,13 @@ func (suite *CreatePollControllerTestSuite) SetupTest() { | |
|
||
func TestCreatePollControllerSuite(t *testing.T) { | ||
// Register the test suite | ||
if os.Getenv("IGNORE_E2E") != "" { | ||
t.Skip("Ignorando testes E2E") | ||
} | ||
suite.Run(t, new(CreatePollControllerTestSuite)) | ||
} | ||
|
||
func (suite *CreatePollControllerTestSuite) TestHandle() { | ||
func (suite *CreatePollControllerTestSuite) TestE2EHandle() { | ||
suite.Run("should return 201 if polls was created", func() { | ||
userID := core.NewUniqueEntityId() | ||
|
||
|
@@ -97,7 +101,7 @@ func (suite *CreatePollControllerTestSuite) TestHandle() { | |
}) | ||
} | ||
|
||
// func (suite *CreatePollControllerTestSuite) TestHandleInvalidData() { | ||
// func (suite *CreatePollControllerTestSuite) TestE2EHandleInvalidData() { | ||
// suite.Run("should return 400 if voter data is not valid", func() { | ||
// suite.e.POST("/auth/register").WithJSON(map[string]interface{}{ | ||
// "email": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package controllers_test | |
|
||
import ( | ||
"net/http" | ||
"os" | ||
"testing" | ||
|
||
"github.com/gavv/httpexpect/v2" | ||
|
@@ -72,10 +73,13 @@ func (suite *FetchPollsControllerTestSuite) SetupTest() { | |
|
||
func TestFetchPollsControllerSuite(t *testing.T) { | ||
// Register the test suite | ||
if os.Getenv("IGNORE_E2E") != "" { | ||
t.Skip("Ignorando testes E2E") | ||
} | ||
suite.Run(t, new(FetchPollsControllerTestSuite)) | ||
} | ||
|
||
func (suite *FetchPollsControllerTestSuite) TestHandle() { | ||
func (suite *FetchPollsControllerTestSuite) TestE2EHandle() { | ||
suite.Run("should return a list of polls", func() { | ||
userID := core.NewUniqueEntityId() | ||
|
||
|
@@ -107,7 +111,7 @@ func (suite *FetchPollsControllerTestSuite) TestHandle() { | |
}) | ||
} | ||
|
||
// func (suite *FetchPollsControllerTestSuite) TestHandleInvalidData() { | ||
// func (suite *FetchPollsControllerTestSuite) TestE2EHandleInvalidData() { | ||
// suite.Run("should return 400 if voter data is not valid", func() { | ||
// suite.e.POST("/auth/register").WithJSON(map[string]interface{}{ | ||
// "email": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package controllers_test | |
|
||
import ( | ||
"net/http" | ||
"os" | ||
"testing" | ||
|
||
"github.com/gavv/httpexpect/v2" | ||
|
@@ -72,10 +73,13 @@ func (suite *GetPollByIdControllerTestSuite) SetupTest() { | |
|
||
func TestGetPollByIdControllerSuite(t *testing.T) { | ||
// Register the test suite | ||
if os.Getenv("IGNORE_E2E") != "" { | ||
t.Skip("Ignorando testes E2E") | ||
} | ||
suite.Run(t, new(GetPollByIdControllerTestSuite)) | ||
} | ||
|
||
func (suite *GetPollByIdControllerTestSuite) TestHandle() { | ||
func (suite *GetPollByIdControllerTestSuite) TestE2EHandle() { | ||
suite.Run("should return a poll by id", func() { | ||
userID := core.NewUniqueEntityId() | ||
|
||
|
@@ -130,7 +134,7 @@ func (suite *GetPollByIdControllerTestSuite) TestHandle() { | |
}) | ||
} | ||
|
||
// func (suite *GetPollByIdControllerTestSuite) TestHandleInvalidData() { | ||
// func (suite *GetPollByIdControllerTestSuite) TestE2EHandleInvalidData() { | ||
// suite.Run("should return 400 if voter data is not valid", func() { | ||
// suite.e.POST("/auth/register").WithJSON(map[string]interface{}{ | ||
// "email": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package controllers_test | |
|
||
import ( | ||
"net/http" | ||
"os" | ||
"testing" | ||
|
||
"github.com/gavv/httpexpect/v2" | ||
|
@@ -67,10 +68,13 @@ func (suite *RegisterVoterControllerTestSuite) SetupTest() { | |
|
||
func TestRegisterVoterControllerSuite(t *testing.T) { | ||
// Register the test suite | ||
if os.Getenv("IGNORE_E2E") != "" { | ||
t.Skip("Ignorando testes E2E") | ||
} | ||
suite.Run(t, new(RegisterVoterControllerTestSuite)) | ||
} | ||
|
||
func (suite *RegisterVoterControllerTestSuite) TestHandle() { | ||
func (suite *RegisterVoterControllerTestSuite) TestE2EHandle() { | ||
suite.Run("should return 204 if voter was created", func() { | ||
suite.e.POST("/auth/register").WithJSON(map[string]interface{}{ | ||
"name": "John Doe", | ||
|
@@ -86,7 +90,7 @@ func (suite *RegisterVoterControllerTestSuite) TestHandle() { | |
}) | ||
} | ||
|
||
func (suite *RegisterVoterControllerTestSuite) TestHandleInvalidData() { | ||
func (suite *RegisterVoterControllerTestSuite) TestE2EHandleInvalidData() { | ||
suite.Run("should return 400 if the data if not valid", func() { | ||
suite.e.POST("/auth/register").WithJSON(map[string]interface{}{ | ||
"name": "", | ||
|
@@ -96,7 +100,7 @@ func (suite *RegisterVoterControllerTestSuite) TestHandleInvalidData() { | |
}) | ||
} | ||
|
||
func (suite *RegisterVoterControllerTestSuite) TestHandleVoterAlreadyExists() { | ||
func (suite *RegisterVoterControllerTestSuite) TestE2EHandleVoterAlreadyExists() { | ||
suite.Run("should return 409 if the voter already exists", func() { | ||
factories.MakePrismaVoter(factories.OptionalVoterParams{ | ||
Email: "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters