mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
26 lines
668 B
Go
26 lines
668 B
Go
package integration
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
object "github.com/zitadel/zitadel/pkg/grpc/object/v2alpha"
|
|
)
|
|
|
|
type DetailsMsg interface {
|
|
GetDetails() *object.Details
|
|
}
|
|
|
|
func AssertDetails[D DetailsMsg](t testing.TB, exptected, actual D) {
|
|
wantDetails, gotDetails := exptected.GetDetails(), actual.GetDetails()
|
|
|
|
if wantDetails != nil {
|
|
assert.NotZero(t, gotDetails.GetSequence())
|
|
}
|
|
wantCD, gotCD := wantDetails.GetChangeDate().AsTime(), gotDetails.GetChangeDate().AsTime()
|
|
assert.WithinRange(t, gotCD, wantCD, wantCD.Add(time.Minute))
|
|
assert.Equal(t, wantDetails.GetResourceOwner(), gotDetails.GetResourceOwner())
|
|
}
|