MCPcopy Create free account
hub / github.com/dnote/dnote / TestNew

Function TestNew

pkg/server/session/session_test.go:26–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestNew(t *testing.T) {
27 u1 := database.User{
28 UUID: "0f5f0054-d23f-4be1-b5fb-57673109e9cb",
29 Email: database.ToNullString("alice@example.com"),
30 }
31
32 u2 := database.User{
33 UUID: "718a1041-bbe6-496e-bbe4-ea7e572c295e",
34 Email: database.ToNullString("bob@example.com"),
35 }
36
37 testCases := []struct {
38 user database.User
39 }{
40 {
41 user: u1,
42 },
43 {
44 user: u2,
45 },
46 }
47
48 for idx, tc := range testCases {
49 t.Run(fmt.Sprintf("user %d", idx), func(t *testing.T) {
50 // Execute
51 got := New(tc.user)
52 expected := Session{
53 UUID: tc.user.UUID,
54 Email: tc.user.Email.String,
55 }
56
57 assert.DeepEqual(t, got, expected, "result mismatch")
58 })
59 }
60}

Callers

nothing calls this directly

Calls 3

ToNullStringFunction · 0.92
DeepEqualFunction · 0.92
NewFunction · 0.70

Tested by

no test coverage detected