Skip to content

Commit

Permalink
feat: increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Oct 23, 2024
1 parent 371f367 commit 10a9b89
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions internal/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (suite *APITestSuite) SetupSuite() {
suite.app = app
}

func (suite *APITestSuite) BadRequest() {
func (suite *APITestSuite) TestBadRequest() {
require := suite.Require()

body, err := json.Marshal(api.AuthRequest{
Expand All @@ -168,10 +168,19 @@ func (suite *APITestSuite) BadRequest() {

defer resp.Body.Close()

require.Equal(http.StatusBadRequest, resp.StatusCode)
require.Equal(http.StatusOK, resp.StatusCode)

data, err := io.ReadAll(resp.Body)
require.NoError(err)

var authResp api.AuthResponse

require.NoError(json.Unmarshal(data, &authResp))

require.Equal("deny", authResp.Result)
}

func (suite *APITestSuite) ValidToken() {
func (suite *APITestSuite) TestValidToken() {
require := suite.Require()

token, err := getSampleToken(suite.key)
Expand Down

0 comments on commit 10a9b89

Please sign in to comment.