add all crates: domain, protocol, application, client, adapters, ESP32 firmware
Server: domain (entities, value objects, ports), protocol (postcard wire types), application (config service, data projection), adapters (config-memory, tcp-server), bootstrap (composition root with fake data). Client: client-domain (layout engine, render tree, HAL ports), client-application (message handling, repaint commands), adapters (tcp-client, display-terminal), client-desktop (end-to-end working). ESP32: client-esp32 firmware with ILI9341 display over SPI, WiFi networking. Display test verified on hardware — landscape orientation, text rendering works. 60 workspace tests, all passing.
This commit is contained in:
33
crates/domain/tests/key_mapping_tests.rs
Normal file
33
crates/domain/tests/key_mapping_tests.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
use std::collections::BTreeMap;
|
||||
use domain::{KeyMapping, Value};
|
||||
|
||||
#[test]
|
||||
fn extracts_value_at_path_and_renames_key() {
|
||||
let mapping = KeyMapping {
|
||||
source_path: "$.main.temp".into(),
|
||||
target_key: "temperature".into(),
|
||||
};
|
||||
|
||||
let raw = Value::Object(BTreeMap::from([
|
||||
("main".into(), Value::Object(BTreeMap::from([
|
||||
("temp".into(), Value::Number(5.4)),
|
||||
]))),
|
||||
]));
|
||||
|
||||
let result = mapping.extract(&raw);
|
||||
assert_eq!(result, Some(("temperature".into(), Value::Number(5.4))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn returns_none_when_path_does_not_match() {
|
||||
let mapping = KeyMapping {
|
||||
source_path: "$.missing.path".into(),
|
||||
target_key: "value".into(),
|
||||
};
|
||||
|
||||
let raw = Value::Object(BTreeMap::from([
|
||||
("other".into(), Value::Number(1.0)),
|
||||
]));
|
||||
|
||||
assert_eq!(mapping.extract(&raw), None);
|
||||
}
|
||||
Reference in New Issue
Block a user