forked from zopsmart/ezgo
-
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.
zopsmart#3 | Resolved renaming of customeerror to customError across …
…layers
- Loading branch information
Showing
10 changed files
with
73 additions
and
71 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 |
---|---|---|
|
@@ -4,5 +4,5 @@ REDIS_HOST=localhost | |
|
||
DB_HOST=localhost | ||
DB_USER=root | ||
DB_PASSWORD=Bittu@1998 | ||
DB_PASSWORD=password | ||
DB_NAME=Hiring |
Binary file not shown.
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
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ import ( | |
"github.com/DATA-DOG/go-sqlmock" | ||
"github.com/vikash/gofr/pkg/gofr" | ||
"github.com/vikash/gofr/pkg/gofr/logging" | ||
customeerror "github.com/zopsmart/hiring-portal-api/panel/error" | ||
customError "github.com/zopsmart/hiring-portal-api/panel/error" | ||
"github.com/zopsmart/hiring-portal-api/panel/models" | ||
) | ||
|
||
|
@@ -52,11 +52,11 @@ func testAllEmployeeService(t *testing.T, c *gofr.Context) { | |
{ | ||
input: -1, | ||
expectedOutput: []models.Employee(nil), | ||
expectedErr: customeerror.ErrInvalidCompanyID, | ||
expectedErr: customError.ErrInvalidCompanyID, | ||
}, | ||
{ | ||
input: 2, | ||
expectedErr: customeerror.ErrDBServer, | ||
expectedErr: customError.ErrDBServer, | ||
}, | ||
} | ||
|
||
|
@@ -85,18 +85,18 @@ func testEmployeeByIDService(t *testing.T, c *gofr.Context) { | |
{ | ||
input: inputData{1, -1}, | ||
expectedOutput: models.Employee{}, | ||
expectedErr: customeerror.ErrInvalidCompanyID, | ||
expectedErr: customError.ErrInvalidCompanyID, | ||
}, | ||
{ | ||
input: inputData{-2, 2}, | ||
expectedOutput: models.Employee{}, | ||
expectedErr: customeerror.ErrInvalidEmployeeID, | ||
expectedErr: customError.ErrInvalidEmployeeID, | ||
}, | ||
|
||
{ | ||
input: inputData{4, 3}, | ||
expectedOutput: models.Employee{}, | ||
expectedErr: customeerror.ErrRecordNotFound, | ||
expectedErr: customError.ErrRecordNotFound, | ||
}, | ||
} | ||
|
||
|
@@ -129,13 +129,13 @@ func testCreateEmployeeService(t *testing.T, c *gofr.Context) { | |
{ | ||
input: InputData{-1, models.Employee{1, "Bittu", "[email protected]", 7250073079, "sde1", 2, 1}}, | ||
expectedOutput: models.Employee{}, | ||
expectedErr: customeerror.ErrInvalidCompanyID, | ||
expectedErr: customError.ErrInvalidCompanyID, | ||
}, | ||
|
||
{ | ||
input: InputData{1, models.Employee{1, "Bittu", "[email protected]", 7250073079, "sde1", 2, 2}}, | ||
expectedOutput: models.Employee{}, | ||
expectedErr: customeerror.ErrDBServer, | ||
expectedErr: customError.ErrDBServer, | ||
}, | ||
} | ||
|
||
|
@@ -168,18 +168,18 @@ func testEditEmployeeService(t *testing.T, c *gofr.Context) { | |
{ | ||
input: InputData{-1, 2, models.Employee{1, "Bittu", "[email protected]", 7250073079, "sde1", 2, 1}}, | ||
expectedOutput: models.Employee{}, | ||
expectedErr: customeerror.ErrInvalidCompanyID, | ||
expectedErr: customError.ErrInvalidCompanyID, | ||
}, | ||
{ | ||
input: InputData{1, -1, models.Employee{1, "Bittu", "[email protected]", 7250073079, "sde1", 2, 2}}, | ||
expectedOutput: models.Employee{}, | ||
expectedErr: customeerror.ErrInvalidEmployeeID, | ||
expectedErr: customError.ErrInvalidEmployeeID, | ||
}, | ||
|
||
{ | ||
input: InputData{1, 2, models.Employee{1, "Bittu", "[email protected]", 7250073079, "sde1", 2, 2}}, | ||
expectedOutput: models.Employee{}, | ||
expectedErr: customeerror.ErrDBServer, | ||
expectedErr: customError.ErrDBServer, | ||
}, | ||
} | ||
|
||
|
@@ -210,16 +210,16 @@ func testDeleteEmployeeService(t *testing.T, c *gofr.Context) { | |
|
||
{ | ||
input: InputData{-1, 2}, | ||
expectedErr: customeerror.ErrInvalidCompanyID, | ||
expectedErr: customError.ErrInvalidCompanyID, | ||
}, | ||
{ | ||
input: InputData{1, -1}, | ||
expectedErr: customeerror.ErrInvalidEmployeeID, | ||
expectedErr: customError.ErrInvalidEmployeeID, | ||
}, | ||
|
||
{ | ||
input: InputData{1, 2}, | ||
expectedErr: customeerror.ErrDBServer, | ||
expectedErr: customError.ErrDBServer, | ||
}, | ||
} | ||
|
||
|
@@ -237,7 +237,7 @@ type mockStore struct { | |
|
||
func (m mockStore) GetAllEmployee(c *gofr.Context, companyID int) ([]models.Employee, error) { | ||
if companyID == 2 { | ||
return nil, customeerror.ErrDBServer | ||
return nil, customError.ErrDBServer | ||
} | ||
|
||
res := []models.Employee{{1, "Bittu", "[email protected]", 7250073079, "sde1", 2, 1}, | ||
|
@@ -252,7 +252,7 @@ func (m mockStore) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) ( | |
return models.Employee{1, "Bittu", "[email protected]", 7250073079, "sde1", 2, 1}, nil | ||
} | ||
if companyID != employeeID { | ||
return models.Employee{}, customeerror.ErrRecordNotFound | ||
return models.Employee{}, customError.ErrRecordNotFound | ||
} | ||
|
||
return models.Employee{}, nil | ||
|
@@ -261,21 +261,21 @@ func (m mockStore) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) ( | |
|
||
func (m mockStore) CreateEmployee(c *gofr.Context, companyID int, emp *models.Employee) (int, error) { | ||
if companyID != emp.CompanyID { | ||
return -1, customeerror.ErrDBServer | ||
return -1, customError.ErrDBServer | ||
} | ||
return companyID, nil | ||
} | ||
|
||
func (m mockStore) EditEmployee(c *gofr.Context, companyID, employeeID int, emp *models.Employee) (int, error) { | ||
if companyID != emp.CompanyID || employeeID != emp.ID { | ||
return -1, customeerror.ErrDBServer | ||
return -1, customError.ErrDBServer | ||
} | ||
return companyID, nil | ||
} | ||
|
||
func (m mockStore) DeleteEmployee(c *gofr.Context, companyID, employeeID int) error { | ||
if companyID != employeeID { | ||
return customeerror.ErrDBServer | ||
return customError.ErrDBServer | ||
} | ||
return nil | ||
} |
Oops, something went wrong.