Add GetID() to model.BaseModel (#1336)
## Type of change - [x] 🐹 Trivial/Minor ## Issue(s) * #1334 ## Test Plan - [x] ⚡ Unit test
This commit is contained in:
parent
efd697f522
commit
8ddbc16077
@ -61,3 +61,8 @@ type BaseModel struct {
|
||||
func (bm *BaseModel) Base() *BaseModel {
|
||||
return bm
|
||||
}
|
||||
|
||||
// GetID returns the baseModel.ID as a string rather than a model.StableID.
|
||||
func (bm *BaseModel) GetID() string {
|
||||
return string(bm.ID)
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package model_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
@ -36,3 +37,11 @@ func (suite *ModelUnitSuite) TestValid() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *ModelUnitSuite) TestGetID() {
|
||||
bm := model.BaseModel{
|
||||
ID: model.StableID(uuid.NewString()),
|
||||
}
|
||||
|
||||
assert.Equal(suite.T(), string(bm.ID), bm.GetID())
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user