feat: add origin config option (#582)

Co-authored-by: Marco Pasqualetti <marco.pasqualetti@live.com>
This commit is contained in:
pveierland
2025-02-28 01:25:03 +08:00
committed by GitHub
parent 5f6bad637c
commit 1ba94238ed
10 changed files with 114 additions and 19 deletions
+24
View File
@@ -20,6 +20,30 @@ fn should_correctly_read_the_config_file() {
let config = config.unwrap();
assert_eq!(config.server.host, "localhost");
assert_eq!(config.server.origin, None);
assert_eq!(config.server.port, 3000);
}
#[test]
#[serial]
fn should_correctly_read_the_config_file_with_origin() {
let folder = TempTuonoProject::new();
folder.add_file_with_content(
"./.tuono/config/config.json",
r#"{ "server": {"host": "localhost", "origin": "https://tuono.localhost", "port": 3000}}"#,
);
let config = Config::get();
assert!(config.is_ok());
let config = config.unwrap();
assert_eq!(config.server.host, "localhost".to_string());
assert_eq!(
config.server.origin,
Some("https://tuono.localhost".to_string())
);
assert_eq!(config.server.port, 3000);
}