package birdfmt import ( "path" "slices" "strings" "testing" ) func TestBirdScenarioPaths_Table(t *testing.T) { paths, err := BirdScenarioPaths() if err != nil { t.Fatal(err) } // Expected scenario leaf names — extend when adding directories under testdata/scenarios. wantNames := []string{ "bgp_dual_peer", "bgp_ipv4_peer", "bgp_ipv6_peer", "domains_resolved", "dynamic_discovery", "empty_static", "filter_export", "large_prefix_list", "minimal", "mixed_static_bgp", "standard_layout", "static_ipv4", "with_include", } var gotNames []string for _, p := range paths { gotNames = append(gotNames, path.Base(p)) } slices.Sort(gotNames) if !slices.Equal(gotNames, wantNames) { t.Fatalf("scenario set drift: got %v want %v", gotNames, wantNames) } for _, p := range paths { t.Run(path.Base(p), func(t *testing.T) { b, err := ReadScenarioBirdConf(p) if err != nil { t.Fatal(err) } if len(b) == 0 { t.Fatal("empty bird.conf") } if !strings.Contains(string(b), "router id") { t.Fatal("expected router id in scenario") } }) } } func TestRepoRelativeBirdConf_Table(t *testing.T) { paths, err := BirdScenarioPaths() if err != nil { t.Fatal(err) } for _, p := range paths { rel := RepoRelativeBirdConf(p) if !strings.HasPrefix(rel, "internal/birdfmt/") { t.Fatalf("%s: bad prefix %q", p, rel) } if !strings.HasSuffix(rel, "/bird.conf") { t.Fatalf("%s: expected .../bird.conf, got %q", p, rel) } } }