Insert election with uuid instead of auto-generated id
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user