--- componentsToMap tests ---
(t *testing.T)
| 382 | // --- componentsToMap tests --- |
| 383 | |
| 384 | func TestEncoder_componentsToMap(t *testing.T) { |
| 385 | e := NewEncoder() |
| 386 | c := model.NewComponents() |
| 387 | c.AddSchema("User", model.NewSchema().SetType(model.SchemaTypeObject).SetTitle("User")) |
| 388 | c.AddSchema("Req", model.NewSchema().SetType(model.SchemaTypeObject).SetTitle("Req")) |
| 389 | |
| 390 | m := e.componentsToMap(c) |
| 391 | schemas, ok := m["schemas"].(map[string]any) |
| 392 | if !ok { |
| 393 | t.Fatal("schemas should be map[string]any") |
| 394 | } |
| 395 | if len(schemas) != 2 { |
| 396 | t.Errorf("expected 2 schemas, got %d", len(schemas)) |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | func TestEncoder_componentsToMap_Empty(t *testing.T) { |
| 401 | e := NewEncoder() |
nothing calls this directly
no test coverage detected