More robust testing

This commit is contained in:
2025-11-05 15:47:26 -05:00
parent 5d579781a8
commit 7ad8a1bcc6
2 changed files with 78 additions and 5 deletions

View File

@@ -8,6 +8,8 @@ import (
"go-sjles-pta-vote/server/models"
)
var ErrQuestionAlreadyExists = errors.New("Question already exists")
func CreatePoll(poll *models.Poll) (*models.Poll, error) {
new_poll := models.Poll{}
@@ -33,7 +35,7 @@ func CreatePoll(poll *models.Poll) (*models.Poll, error) {
if err != nil {
return nil, err
}
return nil, errors.New("Already exists")
return nil, ErrQuestionAlreadyExists
}
stmt, err := db_conn.Prepare(`