Improve Aggregation function & config parser

Refactor aggregation function
Rename visiting_url to url, as they are always the same (see upstream engine scalping).
Refactor parsing function to be more readable.
This commit is contained in:
Milim 2023-08-17 22:48:20 +02:00
parent af3b1cb308
commit 15dfda6ea9
8 changed files with 103 additions and 136 deletions

View file

@ -8,7 +8,7 @@ fn spawn_app() -> String {
// Binding to port 0 will trigger the OS to assign a port for us.
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
let port = listener.local_addr().unwrap().port();
let config = Config::parse(true).unwrap();
let config = Config::parse(false).unwrap();
let server = run(listener, config).expect("Failed to bind address");
tokio::spawn(server);
@ -36,7 +36,7 @@ async fn test_index() {
assert_eq!(res.status(), 200);
let handlebars = handlebars();
let config = Config::parse(false).unwrap();
let config = Config::parse(true).unwrap();
let template = handlebars.render("index", &config.style).unwrap();
assert_eq!(res.text().await.unwrap(), template);
}