Skip to content

Commit

Permalink
Some settings integration testing setup
Browse files Browse the repository at this point in the history
  • Loading branch information
krlvi committed Dec 11, 2024
1 parent 2189b6e commit 4da65ff
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
7 changes: 7 additions & 0 deletions crates/gitbutler-settings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ rust-embed = "8.4.0"
serde_json_lenient = "0.2.3"
gitbutler-settings-util.path = "vendor/util"
gitbutler-fs.workspace = true

[[test]]
name = "settings"
path = "tests/mod.rs"

[dev-dependencies]
gitbutler-settings.workspace = true
3 changes: 2 additions & 1 deletion crates/gitbutler-settings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pub use legacy::LegacySettings;

mod app_settings;
mod json;
mod persistence;
pub mod persistence;
pub use app_settings::AppSettings;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"telemetry": {
"appMetricsEnabled": false
}
}
15 changes: 15 additions & 0 deletions crates/gitbutler-settings/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use gitbutler_settings::AppSettings;

#[test]
#[allow(clippy::bool_assert_comparison)]
fn test_load_settings() {
let settings = AppSettings::load("tests/fixtures/modify_default_true_to_false").unwrap();
assert_eq!(settings.telemetry.app_metrics_enabled, false); // modified
assert_eq!(settings.telemetry.app_error_reporting_enabled, true); // default
assert_eq!(settings.telemetry.app_non_anon_metrics_enabled, false); // default
assert_eq!(settings.telemetry.app_analytics_confirmed, false); // default
assert_eq!(
settings.github_oauth_app.oauth_client_id,
"cd51880daa675d9e6452"
); // default
}

0 comments on commit 4da65ff

Please sign in to comment.