--- schemaToMap tests ---
(t *testing.T)
| 229 | // --- schemaToMap tests --- |
| 230 | |
| 231 | func TestEncoder_schemaToMap_Ref(t *testing.T) { |
| 232 | e := NewEncoder() |
| 233 | schema := &model.Schema{Ref: "#/components/schemas/MyType"} |
| 234 | |
| 235 | m := e.schemaToMap(schema) |
| 236 | if m["$ref"] != "#/components/schemas/MyType" { |
| 237 | t.Errorf("$ref = %v, want #/components/schemas/MyType", m["$ref"]) |
| 238 | } |
| 239 | // Ref schemas should only have $ref |
| 240 | if len(m) != 1 { |
| 241 | t.Errorf("ref schema should only have $ref field, got %d fields", len(m)) |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | func TestEncoder_schemaToMap_FullSchema(t *testing.T) { |
| 246 | e := NewEncoder() |
nothing calls this directly
no test coverage detected