blob: 7db9f64439ce55a3c8ffa2f1d03b1a659d7f1dc1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package identity
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
)
func TestBare_Id(t *testing.T) {
i := NewBare("name", "email")
id := i.Id()
assert.Equal(t, "7b226e616d65223a226e616d65222c22", id)
}
func TestBareSerialize(t *testing.T) {
before := &Bare{
login: "login",
email: "email",
name: "name",
avatarUrl: "avatar",
}
data, err := json.Marshal(before)
assert.NoError(t, err)
var after Bare
err = json.Unmarshal(data, &after)
assert.NoError(t, err)
assert.Equal(t, before, &after)
}
|