aboutsummaryrefslogtreecommitdiffstats
path: root/identity/identity_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'identity/identity_test.go')
-rw-r--r--identity/identity_test.go23
1 files changed, 18 insertions, 5 deletions
diff --git a/identity/identity_test.go b/identity/identity_test.go
index ee6ccdf7..f9091294 100644
--- a/identity/identity_test.go
+++ b/identity/identity_test.go
@@ -79,11 +79,6 @@ func TestIdentityCommitLoad(t *testing.T) {
// add more version
- identity.Mutate(func(orig Mutator) Mutator {
-
- return orig
- })
-
identity.addVersionForTest(&Version{
time: 201,
name: "René Descartes",
@@ -113,6 +108,24 @@ func TestIdentityCommitLoad(t *testing.T) {
assert.Equal(t, identity, loaded)
}
+func TestIdentityMutate(t *testing.T) {
+ identity := NewIdentity("René Descartes", "rene.descartes@example.com")
+
+ assert.Len(t, identity.versions, 1)
+
+ identity.Mutate(func(orig Mutator) Mutator {
+ orig.Email = "rene@descartes.fr"
+ orig.Name = "René"
+ orig.Login = "rene"
+ return orig
+ })
+
+ assert.Len(t, identity.versions, 2)
+ assert.Equal(t, identity.Email(), "rene@descartes.fr")
+ assert.Equal(t, identity.Name(), "René")
+ assert.Equal(t, identity.Login(), "rene")
+}
+
func commitsAreSet(t *testing.T, identity *Identity) {
for _, version := range identity.versions {
assert.NotEmpty(t, version.commitHash)