mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
b363ddd707
* feat: implement projection for iam and clean up code * feat: add migration * fix: remove unused tests * fix: handler
50 lines
1002 B
Go
50 lines
1002 B
Go
package model
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestMailTemplateChanges(t *testing.T) {
|
|
type args struct {
|
|
existing *MailTemplate
|
|
new *MailTemplate
|
|
}
|
|
type res struct {
|
|
changesLen int
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
res res
|
|
}{
|
|
{
|
|
name: "mailtemplate all attributes change",
|
|
args: args{
|
|
existing: &MailTemplate{Template: []byte("<doctype html>")},
|
|
new: &MailTemplate{Template: []byte("<!doctype html>")},
|
|
},
|
|
res: res{
|
|
changesLen: 1,
|
|
},
|
|
},
|
|
{
|
|
name: "no changes",
|
|
args: args{
|
|
existing: &MailTemplate{Template: []byte("<!doctype html>")},
|
|
new: &MailTemplate{Template: []byte("<!doctype html>")},
|
|
},
|
|
res: res{
|
|
changesLen: 0,
|
|
},
|
|
},
|
|
}
|
|
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))
|
|
}
|
|
})
|
|
}
|
|
}
|