MCPcopy
hub / github.com/dosco/graphjin / TestLoadIgnoresNonYAMLFiles

Function TestLoadIgnoresNonYAMLFiles

core/openapi/integration_test.go:240–255  ·  view source on GitHub ↗

TestLoadIgnoresNonYAMLFiles confirms the loader's filter — a stray README.md or .json file in config/specs shouldn't trip the parser.

(t *testing.T)

Source from the content-addressed store, hash-verified

238// TestLoadIgnoresNonYAMLFiles confirms the loader's filter — a stray
239// README.md or .json file in config/specs shouldn't trip the parser.
240func TestLoadIgnoresNonYAMLFiles(t *testing.T) {
241 dir := t.TempDir()
242 if err := os.WriteFile(filepath.Join(dir, "README.md"), []byte("# notes"), 0o644); err != nil {
243 t.Fatal(err)
244 }
245 if err := os.WriteFile(filepath.Join(dir, "notes.txt"), []byte("ignore me"), 0o644); err != nil {
246 t.Fatal(err)
247 }
248 res, err := Load(LoaderOptions{SpecsDir: dir}, nil, nil)
249 if err != nil {
250 t.Fatalf("Load: %v", err)
251 }
252 if len(res.Registry.Specs) != 0 {
253 t.Errorf("expected 0 specs, got %d", len(res.Registry.Specs))
254 }
255}
256
257// TestLoadParseErrorIsWarning confirms a malformed spec produces a
258// warning rather than aborting load — other specs should still be

Callers

nothing calls this directly

Calls 1

LoadFunction · 0.85

Tested by

no test coverage detected