test: build config values with struct update
Clippy rejects assigning fields after Config::default(). Initialize the preview and public URL fields in the struct literal instead. No behavior changes.
This commit is contained in:
1 parent
f21fdfd729
commit
808a78afa8
2 files changed
+12
-7
No files matched your search
+4
-3
@@ -250,9 +250,10 @@ mod tests {
|
|||||||
use axum::http::{HeaderMap, HeaderValue, header};
|
use axum::http::{HeaderMap, HeaderValue, header};
|
||||||
|
|
||||||
fn config() -> crate::config::Config {
|
fn config() -> crate::config::Config {
|
||||||
let mut config = crate::config::Config::default();
|
crate::config::Config {
|
||||||
config.public_url = "http://10.4.1.222:7800".into();
|
public_url: "http://10.4.1.222:7800".into(),
|
||||||
config
|
..Default::default()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn headers(origin: &str, host: &str) -> HeaderMap {
|
fn headers(origin: &str, host: &str) -> HeaderMap {
|
||||||
|
|||||||
+8
-4
@@ -277,8 +277,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_preview_host_carries_room_port_expiry_and_signature() {
|
fn a_preview_host_carries_room_port_expiry_and_signature() {
|
||||||
let mut config = Config::default();
|
let config = Config {
|
||||||
config.preview_origin = "https://preview.example.com".into();
|
preview_origin: "https://preview.example.com".into(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
let (secrets, path) = secrets();
|
let (secrets, path) = secrets();
|
||||||
let url = url(&config, &secrets, "room123", 5173).expect("url");
|
let url = url(&config, &secrets, "room123", 5173).expect("url");
|
||||||
let host = url
|
let host = url
|
||||||
@@ -296,8 +298,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn the_old_host_shape_is_not_accepted() {
|
fn the_old_host_shape_is_not_accepted() {
|
||||||
let mut config = Config::default();
|
let config = Config {
|
||||||
config.preview_origin = "https://preview.example.com".into();
|
preview_origin: "https://preview.example.com".into(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
assert!(
|
assert!(
|
||||||
target_of_host(
|
target_of_host(
|
||||||
&config,
|
&config,
|
||||||
|
|||||||
Reference in new issue
Block a user