Build native iPhone application shell
This commit is contained in:
@@ -7,6 +7,7 @@ use ironstorage::{
|
||||
authentication::{DEFAULT_AUTHENTICATION_TIMEOUT, MAX_AUTHENTICATION_TIMEOUT},
|
||||
config::{ConfigError, ConfigLoader, EditorSource},
|
||||
desktop::DesktopStorage,
|
||||
mobile::MobileTab,
|
||||
};
|
||||
use tempfile::TempDir;
|
||||
|
||||
@@ -178,6 +179,37 @@ fn native_default_path_is_used_without_an_explicit_path() -> TestResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mobile_tab_defaults_and_persists_through_storage_configuration() -> TestResult {
|
||||
let fixture = ConfigurationFixture::new()?;
|
||||
fs::create_dir_all(fixture.temporary.path().join("cwd/vault"))?;
|
||||
fixture.write_explicit(fixture.valid_contents())?;
|
||||
let config = fixture.loader().load(Some(&fixture.explicit_path()))?;
|
||||
assert_eq!(config.mobile_tab(), MobileTab::Home);
|
||||
|
||||
config.update_mobile_tab(MobileTab::Totp)?;
|
||||
let reloaded = fixture.loader().load(Some(&fixture.explicit_path()))?;
|
||||
assert_eq!(reloaded.mobile_tab(), MobileTab::Totp);
|
||||
assert!(
|
||||
fs::read_to_string(fixture.explicit_path())?.contains("selected_mobile_tab = \"totp\"")
|
||||
);
|
||||
|
||||
fixture.write_explicit(&format!(
|
||||
"{}\n[ui]\nselected_mobile_tab = \"unknown\"\n",
|
||||
fixture.valid_contents()
|
||||
))?;
|
||||
assert_eq!(
|
||||
fixture
|
||||
.loader()
|
||||
.load(Some(&fixture.explicit_path()))
|
||||
.expect_err("unknown mobile tab"),
|
||||
ConfigError::InvalidField {
|
||||
field: "ui.selected_mobile_tab"
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn desktop_vault_switch_preserves_and_reloads_the_shared_configuration() -> TestResult {
|
||||
let fixture = ConfigurationFixture::new()?;
|
||||
|
||||
Reference in New Issue
Block a user