v0.2.6-pre.003-fix.004
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ksp-app-wallet-desk",
|
||||
"private": true,
|
||||
"version": "0.2.6-pre.3.fix.3",
|
||||
"version": "0.2.6-pre.3.fix.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "KSP Wallet Desk",
|
||||
"version": "0.2.6-pre.3.fix.3",
|
||||
"version": "0.2.6-pre.3.fix.4",
|
||||
"identifier": "com.sasedev.ksp-app-wallet-desk",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/tests/config_composition.rs
|
||||
// version: 3
|
||||
// version: 4
|
||||
|
||||
//! Config composition contracts introduced for Wallet Desk pre.003.
|
||||
|
||||
@@ -61,7 +61,14 @@ fn assert_wallet_desk_supertrace_profile(composite: &ksp_config_lib::ResolvedCon
|
||||
return value.get("targets");
|
||||
})
|
||||
.and_then(serde_json::Value::as_array);
|
||||
assert_eq!(console_targets.and_then(|value| value.first()).and_then(serde_json::Value::as_str), std::option::Option::Some("*"));
|
||||
assert_eq!(
|
||||
console_targets
|
||||
.and_then(|value| {
|
||||
return value.first();
|
||||
})
|
||||
.and_then(serde_json::Value::as_str),
|
||||
std::option::Option::Some("*")
|
||||
);
|
||||
let files = profile.get("files").and_then(serde_json::Value::as_array);
|
||||
assert_eq!(files.map(std::vec::Vec::len), std::option::Option::Some(7));
|
||||
if let std::option::Option::Some(files) = files {
|
||||
@@ -77,10 +84,22 @@ fn assert_wallet_desk_supertrace_profile(composite: &ksp_config_lib::ResolvedCon
|
||||
assert!(
|
||||
files.iter().any(|file| -> bool {
|
||||
let filter = file.get("filter");
|
||||
let level = filter.and_then(|value| value.get("level")).and_then(serde_json::Value::as_str);
|
||||
let targets = filter.and_then(|value| value.get("targets")).and_then(serde_json::Value::as_array);
|
||||
let level = filter
|
||||
.and_then(|value| {
|
||||
return value.get("level");
|
||||
})
|
||||
.and_then(serde_json::Value::as_str);
|
||||
let targets = filter
|
||||
.and_then(|value| {
|
||||
return value.get("targets");
|
||||
})
|
||||
.and_then(serde_json::Value::as_array);
|
||||
return level == std::option::Option::Some("trace")
|
||||
&& targets.is_some_and(|targets| targets.iter().any(|value| value.as_str() == std::option::Option::Some(target)));
|
||||
&& targets.is_some_and(|targets| {
|
||||
return targets.iter().any(|value| {
|
||||
return value.as_str() == std::option::Option::Some(target);
|
||||
});
|
||||
});
|
||||
}),
|
||||
"supertrace should contain one trace file sink for target {target}"
|
||||
);
|
||||
|
||||
@@ -49,10 +49,15 @@ fn committed_logging_document_exposes_reusable_operational_profiles() {
|
||||
let profiles = document.value().get("profiles").and_then(serde_json::Value::as_array);
|
||||
assert!(profiles.is_some(), "validated Logging document should retain profiles");
|
||||
if let std::option::Option::Some(profiles) = profiles {
|
||||
for profile_id in ["console_error", "console_warn", "console_info", "console_debug", "console_trace", "file_info", "local_dev", "superdev", "supertrace"] {
|
||||
assert!(profiles.iter().any(|profile| -> bool {
|
||||
return profile.get("profile_id").and_then(serde_json::Value::as_str) == std::option::Option::Some(profile_id);
|
||||
}), "committed Logging document is missing profile {profile_id}");
|
||||
for profile_id in
|
||||
["console_error", "console_warn", "console_info", "console_debug", "console_trace", "file_info", "local_dev", "superdev", "supertrace"]
|
||||
{
|
||||
assert!(
|
||||
profiles.iter().any(|profile| -> bool {
|
||||
return profile.get("profile_id").and_then(serde_json::Value::as_str) == std::option::Option::Some(profile_id);
|
||||
}),
|
||||
"committed Logging document is missing profile {profile_id}"
|
||||
);
|
||||
}
|
||||
assert_super_profile(profiles, "superdev", "debug");
|
||||
assert_super_profile(profiles, "supertrace", "trace");
|
||||
@@ -69,16 +74,29 @@ fn assert_super_profile(profiles: &[serde_json::Value], profile_id: &str, file_l
|
||||
if let std::option::Option::Some(profile) = profile {
|
||||
let console_level = profile
|
||||
.get("console")
|
||||
.and_then(|value| { return value.get("filter"); })
|
||||
.and_then(|value| { return value.get("level"); })
|
||||
.and_then(|value| {
|
||||
return value.get("filter");
|
||||
})
|
||||
.and_then(|value| {
|
||||
return value.get("level");
|
||||
})
|
||||
.and_then(serde_json::Value::as_str);
|
||||
assert_eq!(console_level, std::option::Option::Some("debug"));
|
||||
let files = profile.get("files").and_then(serde_json::Value::as_array);
|
||||
assert_eq!(files.map(std::vec::Vec::len), std::option::Option::Some(7));
|
||||
if let std::option::Option::Some(files) = files {
|
||||
assert!(files.iter().all(|file| -> bool {
|
||||
return file.get("filter").and_then(|value| { return value.get("level"); }).and_then(serde_json::Value::as_str) == std::option::Option::Some(file_level);
|
||||
}), "all {profile_id} file sinks should use level {file_level}");
|
||||
assert!(
|
||||
files.iter().all(|file| -> bool {
|
||||
return file
|
||||
.get("filter")
|
||||
.and_then(|value| {
|
||||
return value.get("level");
|
||||
})
|
||||
.and_then(serde_json::Value::as_str)
|
||||
== std::option::Option::Some(file_level);
|
||||
}),
|
||||
"all {profile_id} file sinks should use level {file_level}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user