(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func 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 | } |
nothing calls this directly
no test coverage detected