(t *testing.T)
| 608 | } |
| 609 | |
| 610 | func TestGetSchema_TruncatedAt201(t *testing.T) { |
| 611 | // Build 201 tables; the 201st sorted entry should be dropped. |
| 612 | tables := make([]map[string]any, schemaTableLimit+1) |
| 613 | for i := range tables { |
| 614 | tables[i] = makeTable(fmt.Sprintf("t%03d", i), 0, []map[string]any{makeColumn("id", "int4", false)}, nil) |
| 615 | } |
| 616 | resp := makeMetadataResponse(makeSchema("public", tables...)) |
| 617 | s, _ := mockMetadataServer(t, employeeDB(), resp) |
| 618 | |
| 619 | _, structured, err := s.handleGetSchema(testContext(), nil, SchemaInput{ |
| 620 | Database: "employee_db", |
| 621 | Include: "columns", |
| 622 | }) |
| 623 | require.NoError(t, err) |
| 624 | output, ok := structured.(*SchemaOutput) |
| 625 | require.True(t, ok) |
| 626 | section := output.Schemas[0] |
| 627 | require.Len(t, section.Tables, schemaTableLimit) |
| 628 | require.True(t, section.Truncated) |
| 629 | require.Equal(t, schemaTableLimit, section.TablesShown) |
| 630 | // The names are t000..t200; sorted alphabetically the 201st (last) is t200, |
| 631 | // which should be dropped. Remaining last table is t199. |
| 632 | require.Equal(t, "t199", section.Tables[schemaTableLimit-1].Name) |
| 633 | } |
| 634 | |
| 635 | func TestGetSchema_PerSchemaLimitSemantics(t *testing.T) { |
| 636 | // Build 3 schemas with 201 tables each (enough to trigger truncation in each). |
nothing calls this directly
no test coverage detected