Insert election with uuid instead of auto-generated id

This commit is contained in:
2025-01-20 10:04:15 +01:00
parent 729fbecae6
commit 5668b1cd6a
13 changed files with 94 additions and 360 deletions

View File

@ -2,6 +2,7 @@ package mappers
import (
"code.dlmw.ch/dlmw/qv/internal/models"
uuid2 "github.com/google/uuid"
"github.com/stretchr/testify/assert"
"testing"
"time"
@ -19,8 +20,9 @@ func TestElectionResponse(t *testing.T) {
t.Fatal(err.Error())
}
uuid, _ := uuid2.NewV7()
election := models.Election{
ID: 15,
ID: uuid.String(),
Name: "The best",
Tokens: 100,
AreVotersKnown: true,
@ -32,7 +34,7 @@ func TestElectionResponse(t *testing.T) {
response := ElectionResponse(&election)
assert.Equal(t, 15, response.Id)
assert.Equal(t, uuid.String(), response.Id)
assert.Equal(t, "The best", response.Name)
assert.Equal(t, 100, response.Tokens)
assert.Equal(t, true, response.AreVotersKnown)