(t *testing.T, actual map[string]*schema.Relationships, expected map[string]EmbeddedRelations)
| 207 | } |
| 208 | |
| 209 | func checkEmbeddedRelations(t *testing.T, actual map[string]*schema.Relationships, expected map[string]EmbeddedRelations) { |
| 210 | for name, relations := range actual { |
| 211 | rs := expected[name] |
| 212 | t.Run("CheckEmbeddedRelations/"+name, func(t *testing.T) { |
| 213 | if len(relations.Relations) != len(rs.Relations) { |
| 214 | t.Errorf("schema relations count don't match, expects %d, got %d", len(rs.Relations), len(relations.Relations)) |
| 215 | } |
| 216 | if len(relations.EmbeddedRelations) != len(rs.EmbeddedRelations) { |
| 217 | t.Errorf("schema embedded relations count don't match, expects %d, got %d", len(rs.EmbeddedRelations), len(relations.EmbeddedRelations)) |
| 218 | } |
| 219 | for n, rel := range relations.Relations { |
| 220 | if r, ok := rs.Relations[n]; !ok { |
| 221 | t.Errorf("failed to find relation by name %s", n) |
| 222 | } else { |
| 223 | checkSchemaRelation(t, &schema.Schema{ |
| 224 | Relationships: schema.Relationships{ |
| 225 | Relations: map[string]*schema.Relationship{n: rel}, |
| 226 | }, |
| 227 | }, r) |
| 228 | } |
| 229 | } |
| 230 | checkEmbeddedRelations(t, relations.EmbeddedRelations, rs.EmbeddedRelations) |
| 231 | }) |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | func checkField(t *testing.T, s *schema.Schema, value reflect.Value, values map[string]interface{}) { |
| 236 | for k, v := range values { |
no test coverage detected