MCPcopy Create free account
hub / github.com/clawshell/clawshell / assert_valid_config

Function assert_valid_config

src/config.rs:628–648  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

626 }
627
628 fn assert_valid_config(path: &Path) -> Result<(), String> {
629 let config = Config::from_file(path)
630 .map_err(|e| format!("expected valid config {}: {e}", path.display()))?;
631 let snapshot = ConfigSnapshot {
632 derived: DerivedValues {
633 listen_addr: config.listen_addr(),
634 openai_upstream_url: config.upstream_url(Provider::Openai),
635 anthropic_upstream_url: config.upstream_url(Provider::Anthropic),
636 key_map: config.key_map(),
637 },
638 config,
639 };
640 let name = snapshot_name(path)?;
641 insta::with_settings!({
642 snapshot_path => "../tests/snapshots",
643 prepend_module_to_snapshot => false,
644 }, {
645 insta::assert_yaml_snapshot!(name, snapshot);
646 });
647 Ok(())
648 }
649
650 fn assert_invalid_config(path: &Path) -> Result<(), String> {
651 let err = Config::from_file(path).expect_err(&format!(

Callers 1

Calls 4

snapshot_nameFunction · 0.85
listen_addrMethod · 0.80
key_mapMethod · 0.80
upstream_urlMethod · 0.45

Tested by 1