diff options
| -rw-r--r-- | installer-downloader/src/environment.rs | 4 | ||||
| -rw-r--r-- | installer-downloader/tests/controller.rs | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/installer-downloader/src/environment.rs b/installer-downloader/src/environment.rs index 4b17575912..f2bb691d5a 100644 --- a/installer-downloader/src/environment.rs +++ b/installer-downloader/src/environment.rs @@ -2,9 +2,11 @@ use mullvad_update::version::VersionArchitecture; /// The environment consists of globals and/or constants which need to be computed at runtime. pub struct Environment { - pub architecture: mullvad_update::format::Architecture, + pub architecture: Architecture, } +pub type Architecture = mullvad_update::format::Architecture; + pub enum Error { /// Failed to get the host's CPU architecture. Arch, diff --git a/installer-downloader/tests/controller.rs b/installer-downloader/tests/controller.rs index aa74c308b8..3c7c56a3c1 100644 --- a/installer-downloader/tests/controller.rs +++ b/installer-downloader/tests/controller.rs @@ -9,6 +9,7 @@ use insta::assert_yaml_snapshot; use installer_downloader::controller::AppController; use installer_downloader::delegate::{AppDelegate, AppDelegateQueue, ErrorMessage}; +use installer_downloader::environment::{Architecture, Environment}; use installer_downloader::temp::DirectoryProvider; use installer_downloader::ui_downloader::UiAppDownloaderParameters; use mullvad_update::api::VersionInfoProvider; @@ -34,6 +35,10 @@ static FAKE_VERSION: LazyLock<VersionInfo> = LazyLock::new(|| VersionInfo { beta: None, }); +const FAKE_ENVIRONMENT: Environment = Environment { + architecture: Architecture::X86, +}; + #[async_trait::async_trait] impl VersionInfoProvider for FakeVersionInfoProvider { async fn get_version_info(&self, _params: VersionParameters) -> anyhow::Result<VersionInfo> { @@ -357,6 +362,7 @@ async fn test_fetch_version() { AppController::initialize::<_, FakeAppDownloaderHappyPath, _, FakeDirectoryProvider<true>>( &mut delegate, FakeVersionInfoProvider {}, + FAKE_ENVIRONMENT, ); // The app should start out by fetching the current app version @@ -380,6 +386,7 @@ async fn test_download() { AppController::initialize::<_, FakeAppDownloaderHappyPath, _, FakeDirectoryProvider<true>>( &mut delegate, FakeVersionInfoProvider {}, + FAKE_ENVIRONMENT, ); // Wait for the version info @@ -425,6 +432,7 @@ async fn test_failed_verification() { AppController::initialize::<_, FakeAppDownloaderVerifyFail, _, FakeDirectoryProvider<true>>( &mut delegate, FakeVersionInfoProvider {}, + FAKE_ENVIRONMENT, ); // Wait for the version info @@ -462,6 +470,7 @@ async fn test_failed_directory_creation() { AppController::initialize::<_, FakeAppDownloaderHappyPath, _, FakeDirectoryProvider<false>>( &mut delegate, FakeVersionInfoProvider {}, + FAKE_ENVIRONMENT, ); // Wait for the version info |
