08e5f797f8
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18 lines
490 B
Rust
18 lines
490 B
Rust
use clap::Parser;
|
|
use server::Config;
|
|
|
|
#[test]
|
|
fn parses_from_args_with_defaults() {
|
|
let cfg = Config::try_parse_from(["server", "--database-url", "postgres://localhost/test"])
|
|
.expect("should parse");
|
|
|
|
assert_eq!(cfg.database_url, "postgres://localhost/test");
|
|
assert_eq!(cfg.bind_addr, "0.0.0.0:8080");
|
|
assert_eq!(cfg.app_name, "Collection Management System");
|
|
}
|
|
|
|
#[test]
|
|
fn database_url_is_required() {
|
|
assert!(Config::try_parse_from(["server"]).is_err());
|
|
}
|