mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-11 23:33:40 +00:00
b363ddd707
* feat: implement projection for iam and clean up code * feat: add migration * fix: remove unused tests * fix: handler
50 lines
998 B
Go
50 lines
998 B
Go
package model
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestIdpConfigChanges(t *testing.T) {
|
|
type args struct {
|
|
existing *IDPConfig
|
|
new *IDPConfig
|
|
}
|
|
type res struct {
|
|
changesLen int
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
res res
|
|
}{
|
|
{
|
|
name: "idp config name changes",
|
|
args: args{
|
|
existing: &IDPConfig{IDPConfigID: "IDPConfigID", Name: "Name"},
|
|
new: &IDPConfig{IDPConfigID: "IDPConfigID", Name: "NameChanged"},
|
|
},
|
|
res: res{
|
|
changesLen: 2,
|
|
},
|
|
},
|
|
{
|
|
name: "no changes",
|
|
args: args{
|
|
existing: &IDPConfig{IDPConfigID: "IDPConfigID", Name: "Name"},
|
|
new: &IDPConfig{IDPConfigID: "IDPConfigID", Name: "Name"},
|
|
},
|
|
res: res{
|
|
changesLen: 1,
|
|
},
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
changes := tt.args.existing.Changes(tt.args.new)
|
|
if len(changes) != tt.res.changesLen {
|
|
t.Errorf("got wrong changes len: expected: %v, actual: %v ", tt.res.changesLen, len(changes))
|
|
}
|
|
})
|
|
}
|
|
}
|