(t *testing.T)
| 59 | } |
| 60 | |
| 61 | func TestCreate_SessionNameInRequest(t *testing.T) { |
| 62 | var gotBody map[string]any |
| 63 | mux := http.NewServeMux() |
| 64 | mux.HandleFunc("/api/sessions", func(w http.ResponseWriter, r *http.Request) { |
| 65 | json.NewDecoder(r.Body).Decode(&gotBody) |
| 66 | w.Header().Set("Content-Type", "application/json") |
| 67 | w.Write(mustJSON(t, map[string]any{"data": map[string]any{"id": "s", "user_id": "u"}})) |
| 68 | }) |
| 69 | |
| 70 | svc := newService(t, mux) |
| 71 | svc.Create(context.Background(), &adksession.CreateRequest{ |
| 72 | AppName: "app", |
| 73 | UserID: "u", |
| 74 | State: map[string]any{"session_name": "My Session"}, |
| 75 | }) |
| 76 | |
| 77 | if gotBody["name"] != "My Session" { |
| 78 | t.Errorf("name in request body = %v, want 'My Session'", gotBody["name"]) |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | func TestGet_DeserializesEvents(t *testing.T) { |
| 83 | event := map[string]any{ |
nothing calls this directly
no test coverage detected