Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

23.9 KB
Raw Blame
use super::testing_harness::with_mock_override_env;
use super::*;
use macro_env::Environment;

const ENVS: [Environment; 3] = [
    Environment::Production,
    Environment::Develop,
    Environment::Local,
];

fn assert_parses_for_all_environments<T>(service_url_for_environment: impl Fn(Environment) -> T)
where
    T: AsRef<str>,
{
    for environment in ENVS {
        service_url_for_environment(environment)
            .as_ref()
            .parse::<Url>()
            .unwrap();
    }
}

#[test]
fn app_service_url_parses() {
    assert_parses_for_all_environments(AppServiceUrl::default_for_environment);
}

#[test]
fn auth_service_url_parses() {
    assert_parses_for_all_environments(AuthServiceUrl::default_for_environment);
}

#[test]
fn document_storage_service_url_parses() {
    assert_parses_for_all_environments(DocumentStorageServiceUrl::default_for_environment);
}

#[test]
fn convert_service_url_parses() {
    assert_parses_for_all_environments(ConvertServiceUrl::default_for_environment);
}

#[test]
fn convert_service_url_has_no_trailing_slash() {
    for environment in ENVS {
        let url = ConvertServiceUrl::default_for_environment(environment);
        assert!(
            !url.as_ref().ends_with('/'),
            "clients concatenate paths, so {} must not end with /",
            url.as_ref()
        );
    }
}

#[test]
fn search_processing_service_url_parses() {
    assert_parses_for_all_environments(SearchProcessingServiceUrl::default_for_environment);
}

#[test]
fn search_processing_service_url_has_no_trailing_slash() {
    for environment in ENVS {
        let url = SearchProcessingServiceUrl::default_for_environment(environment);
        assert!(
            !url.as_ref().ends_with('/'),
            "clients concatenate paths, so {} must not end with /",
            url.as_ref()
        );
    }
}

#[test]
fn connection_gateway_url_parses() {
    assert_parses_for_all_environments(ConnectionGatewayUrl::default_for_environment);
}

#[test]
fn connection_gateway_url_has_no_trailing_slash() {
    for environment in ENVS {
        let url = ConnectionGatewayUrl::default_for_environment(environment);
        assert!(
            !url.as_ref().ends_with('/'),
            "clients concatenate paths, so {} must not end with /",
            url.as_ref()
        );
    }
}

#[test]
fn connection_gateway_websocket_url_parses() {
    assert_parses_for_all_environments(ConnectionGatewayWebsocketUrl::default_for_environment);
}

#[test]
fn connection_gateway_websocket_url_has_no_trailing_slash() {
    for environment in ENVS {
        let url = ConnectionGatewayWebsocketUrl::default_for_environment(environment);
        assert!(
            !url.as_ref().ends_with('/'),
            "clients concatenate paths, so {} must not end with /",
            url.as_ref()
        );
    }
}

#[test]
fn connection_gateway_websocket_url_is_the_ws_form_of_the_http_url() {
    for environment in ENVS {
        let http = ConnectionGatewayUrl::default_for_environment(environment);
        let websocket = ConnectionGatewayWebsocketUrl::default_for_environment(environment);
        let expected = http.as_ref().replacen("http", "ws", 1);
        assert_eq!(
            websocket.as_ref(),
            expected,
            "{environment:?}: websocket URL must be the http URL with the scheme swapped to ws"
        );
    }
}

#[test]
fn document_cognition_service_url_parses() {
    assert_parses_for_all_environments(DocumentCognitionServiceUrl::default_for_environment);
}

#[test]
fn document_cognition_service_url_has_no_trailing_slash() {
    for environment in ENVS {
        let url = DocumentCognitionServiceUrl::default_for_environment(environment);
        assert!(
            !url.as_ref().ends_with('/'),
            "clients concatenate paths, so {} must not end with /",
            url.as_ref()
        );
    }
}

#[test]
fn notification_service_url_parses() {
    assert_parses_for_all_environments(NotificationServiceUrl::default_for_environment);
}

#[test]
fn static_file_service_url_parses() {
    assert_parses_for_all_environments(StaticFileServiceUrl::default_for_environment);
}

#[test]
fn static_file_public_url_parses() {
    assert_parses_for_all_environments(StaticFilePublicUrl::default_for_environment);
}

#[test]
fn agent_harness_service_url_parses() {
    assert_parses_for_all_environments(AgentHarnessServiceUrl::default_for_environment);
}

#[test]
fn scheduled_action_service_url_parses() {
    assert_parses_for_all_environments(ScheduledActionServiceUrl::default_for_environment);
    assert_eq!(
        ScheduledActionServiceUrl::local().as_ref(),
        "http://localhost:8101/scheduled-action"
    );
    assert_eq!(
        ScheduledActionServiceUrl::dev().as_ref(),
        "https://dev-gateway.macro.com/scheduled-action"
    );
    assert_eq!(
        ScheduledActionServiceUrl::prod().as_ref(),
        "https://gateway.macro.com/scheduled-action"
    );
}

#[test]
fn agent_harness_service_url_has_no_trailing_slash() {
    for environment in ENVS {
        let url = AgentHarnessServiceUrl::default_for_environment(environment);
        assert!(
            !url.as_ref().ends_with('/'),
            "clients concatenate paths, so {} must not end with /",
            url.as_ref()
        );
    }
}

#[test]
fn agent_harness_egress_url_parses() {
    assert_parses_for_all_environments(AgentHarnessEgressUrl::default_for_environment);
}

#[test]
fn agent_harness_egress_url_selects_defaults_without_a_required_config_value() {
    with_mock_override_env(missing_override, || {
        for (environment, expected) in [
            (Environment::Local, "http://localhost:8102"),
            (
                Environment::Develop,
                "https://dev-gateway.macro.com/agent-harness-egress",
            ),
            (
                Environment::Production,
                "https://gateway.macro.com/agent-harness-egress",
            ),
        ] {
            let url = AgentHarnessEgressUrl::new_for_environment(environment).unwrap();
            assert_eq!(url.as_str(), expected);
            assert!(!url.as_str().ends_with('/'));
        }
    });
}

#[test]
fn agent_harness_egress_url_honors_the_standard_override_for_tunnels() {
    with_mock_override_env(
        |name| {
            assert_eq!(name, "OVERRIDE_AGENT_HARNESS_EGRESS_URL");
            Ok("https://egress-test.trycloudflare.com".to_owned())
        },
        || {
            for environment in ENVS {
                let url = AgentHarnessEgressUrl::new_for_environment(environment).unwrap();
                assert_eq!(url.as_str(), "https://egress-test.trycloudflare.com");
            }
        },
    );
}

#[test]
fn mcp_service_url_parses() {
    assert_parses_for_all_environments(McpServiceUrl::default_for_environment);
}

#[test]
fn mcp_service_url_defaults_are_bases_without_a_trailing_slash() {
    with_mock_override_env(missing_override, || {
        for (environment, expected) in [
            (Environment::Local, "http://localhost:8101"),
            (Environment::Develop, "https://dev-gateway.macro.com/mcp"),
            (Environment::Production, "https://gateway.macro.com/mcp"),
        ] {
            let url = McpServiceUrl::new_for_environment(environment).unwrap();
            assert_eq!(url.as_str(), expected);
            assert!(!url.as_str().ends_with('/'));
        }
    });
}

#[test]
fn mcp_service_url_honors_the_standard_override() {
    with_mock_override_env(
        |name| {
            assert_eq!(name, "OVERRIDE_MCP_SERVICE_URL");
            Ok("http://mcp-service:8080".to_owned())
        },
        || {
            let url = McpServiceUrl::new_for_environment(Environment::Local).unwrap();
            assert_eq!(url.as_str(), "http://mcp-service:8080");
        },
    );
}

#[test]
fn unfurl_service_url_parses() {
    assert_parses_for_all_environments(UnfurlServiceUrl::default_for_environment);
}

#[test]
fn contacts_service_url_parses() {
    assert_parses_for_all_environments(ContactsServiceUrl::default_for_environment);
}

#[test]
fn contacts_service_url_has_no_trailing_slash() {
    for environment in ENVS {
        let url = ContactsServiceUrl::default_for_environment(environment);
        assert!(
            !url.as_ref().ends_with('/'),
            "clients concatenate paths, so {} must not end with /",
            url.as_ref()
        );
    }
}

#[test]
fn email_service_url_parses() {
    assert_parses_for_all_environments(EmailServiceUrl::default_for_environment);
}

#[test]
fn email_service_url_has_no_trailing_slash() {
    for environment in ENVS {
        let url = EmailServiceUrl::default_for_environment(environment);
        assert!(
            !url.as_ref().ends_with('/'),
            "clients concatenate paths, so {} must not end with /",
            url.as_ref()
        );
    }
}

#[test]
fn image_proxy_service_url_parses() {
    assert_parses_for_all_environments(ImageProxyServiceUrl::default_for_environment);
}

#[test]
fn image_proxy_service_url_has_no_trailing_slash() {
    for environment in ENVS {
        let url = ImageProxyServiceUrl::default_for_environment(environment);
        assert!(
            !url.as_ref().ends_with('/'),
            "clients concatenate paths, so {} must not end with /",
            url.as_ref()
        );
    }
}

#[test]
fn lexical_service_url_parses() {
    assert_parses_for_all_environments(LexicalServiceUrl::default_for_environment);
}

#[test]
fn sync_service_url_parses() {
    assert_parses_for_all_environments(SyncServiceUrl::default_for_environment);
}

crate::service_url! {
    #[derive(Debug, Clone)]
    pub struct TestServiceUrl {
        local: "http://localhost:8080",
        dev: "https://test-dev.macro.com",
        prod: "https://test.macro.com",
    }
}

fn missing_override(_: &'static str) -> Result<String, std::env::VarError> {
    Err(std::env::VarError::NotPresent)
}

#[test]
fn defaults_are_selected_by_environment() {
    with_mock_override_env(missing_override, || {
        assert_eq!(
            TestServiceUrl::new_for_environment(macro_env::Environment::Local)
                .unwrap()
                .as_ref(),
            "http://localhost:8080",
        );
        assert_eq!(
            TestServiceUrl::new_for_environment(macro_env::Environment::Develop)
                .unwrap()
                .as_ref(),
            "https://test-dev.macro.com",
        );
        assert_eq!(
            TestServiceUrl::new_for_environment(macro_env::Environment::Production)
                .unwrap()
                .as_ref(),
            "https://test.macro.com",
        );
    });
}

#[test]
fn default_values_are_borrowed() {
    let service_url = TestServiceUrl::default_for_environment(macro_env::Environment::Local);

    assert_eq!(service_url.as_ref(), "http://localhost:8080");
    assert_eq!(
        service_url.inner().borrowed_inner(),
        Some("http://localhost:8080"),
    );
}

fn mock_test_service_override(var_name: &'static str) -> Result<String, std::env::VarError> {
    (var_name == "OVERRIDE_TEST_SERVICE_URL")
        .then(|| "https://override.macro.com".to_string())
        .ok_or(std::env::VarError::NotPresent)
}

#[test]
fn override_env_var_wins_over_environment_default() {
    let service_url = with_mock_override_env(mock_test_service_override, || {
        TestServiceUrl::new_for_environment(macro_env::Environment::Local).unwrap()
    });

    assert_eq!(service_url.as_ref(), "https://override.macro.com");
    assert_eq!(
        service_url.override_env_var_name(),
        "OVERRIDE_TEST_SERVICE_URL",
    );
    assert_eq!(
        service_url.inner().owned_inner().unwrap(),
        "https://override.macro.com",
    );
}

#[test]
fn helpers_construct_expected_defaults() {
    assert_eq!(TestServiceUrl::local().as_ref(), "http://localhost:8080");
    assert_eq!(TestServiceUrl::dev().as_ref(), "https://test-dev.macro.com");
    assert_eq!(TestServiceUrl::prod().as_ref(), "https://test.macro.com");
}

#[test]
fn copied_returns_a_borrowed_view() {
    let service_url = TestServiceUrl::from_owned("https://runtime.macro.com");
    let copied = service_url.copied();

    assert_eq!(copied.as_ref(), "https://runtime.macro.com");
    assert_eq!(copied.borrowed_inner(), Some("https://runtime.macro.com"));
}

crate::service_url! {
    #[derive(Debug)]
    pub struct TestServiceUrls {
        #[derive(Debug, Clone)]
        pub TestDocumentStorageServiceUrl {
            local: "http://localhost:8086",
            dev: "https://dev-gateway.macro.com/dss",
            prod: "https://gateway.macro.com/dss",
        },
        #[derive(Debug, Clone)]
        pub TestEmailServiceUrl {
            local: "http://localhost:8087",
            dev: "https://dev-gateway.macro.com/email",
            prod: "https://gateway.macro.com/email",
        },
    }
}

fn mock_group_overrides(var_name: &'static str) -> Result<String, std::env::VarError> {
    match var_name {
        "OVERRIDE_TEST_EMAIL_SERVICE_URL" => Ok("https://email-override.macro.com".to_string()),
        _ => Err(std::env::VarError::NotPresent),
    }
}

#[test]
fn grouped_macro_resolves_all_service_urls() {
    let service_urls = with_mock_override_env(mock_group_overrides, || {
        TestServiceUrls::new_for_environment(macro_env::Environment::Develop).unwrap()
    });

    assert_eq!(
        service_urls.test_document_storage_service_url.as_ref(),
        "https://dev-gateway.macro.com/dss",
    );
    assert_eq!(
        service_urls.test_email_service_url.as_ref(),
        "https://email-override.macro.com",
    );
}

#[test]
fn grouped_defaults_do_not_check_overrides() {
    let service_urls = TestServiceUrls::default_for_environment(macro_env::Environment::Production);

    assert_eq!(
        service_urls.test_document_storage_service_url.as_ref(),
        "https://gateway.macro.com/dss",
    );
    assert_eq!(
        service_urls.test_email_service_url.as_ref(),
        "https://gateway.macro.com/email",
    );
}

#[test]
fn exported_service_urls_match_local_values() {
    let service_urls = ServiceUrls::default_for_environment(macro_env::Environment::Local);

    assert_eq!(
        service_urls.app_service_url.as_ref(),
        "http://localhost:3000"
    );
    assert_eq!(
        service_urls.auth_service_url.as_ref(),
        "http://localhost:8080"
    );
    assert_eq!(
        service_urls.document_storage_service_url.as_ref(),
        "http://localhost:8086",
    );
    assert_eq!(
        service_urls.convert_service_url.as_ref(),
        "http://localhost:8080",
    );
    assert_eq!(
        service_urls.search_processing_service_url.as_ref(),
        "http://localhost:8092",
    );
    assert_eq!(
        service_urls.connection_gateway_url.as_ref(),
        "http://localhost:8082",
    );
    assert_eq!(
        service_urls.connection_gateway_websocket_url.as_ref(),
        "ws://localhost:8082",
    );
    assert_eq!(
        service_urls.document_cognition_service_url.as_ref(),
        "http://localhost:8101/cognition",
    );
    assert_eq!(
        service_urls.notification_service_url.as_ref(),
        "http://localhost:8089",
    );
    assert_eq!(
        service_urls.static_file_service_url.as_ref(),
        "http://localhost:8100",
    );
    assert_eq!(
        service_urls.agent_harness_egress_url.as_ref(),
        "http://localhost:8102",
    );
    assert_eq!(
        service_urls.mcp_service_url.as_ref(),
        "http://localhost:8101"
    );
    assert_eq!(
        service_urls.unfurl_service_url.as_ref(),
        "http://localhost:8095"
    );
    assert_eq!(
        service_urls.contacts_service_url.as_ref(),
        "http://localhost:8083"
    );
    assert_eq!(
        service_urls.email_service_url.as_ref(),
        "http://localhost:8087"
    );
    assert_eq!(
        service_urls.calendar_service_url.as_ref(),
        "http://localhost:8088"
    );
    assert_eq!(
        service_urls.image_proxy_service_url.as_ref(),
        "http://localhost:8097",
    );
    assert_eq!(
        service_urls.lexical_service_url.as_ref(),
        "http://localhost:8096"
    );
    assert_eq!(
        service_urls.sync_service_url.as_ref(),
        "http://localhost:8787"
    );
}

#[test]
fn exported_service_urls_match_dev_values() {
    let service_urls = ServiceUrls::default_for_environment(macro_env::Environment::Develop);

    assert_eq!(
        service_urls.app_service_url.as_ref(),
        "https://dev.macro.com"
    );
    assert_eq!(
        service_urls.auth_service_url.as_ref(),
        "https://dev-gateway.macro.com/auth",
    );
    assert_eq!(
        service_urls.document_storage_service_url.as_ref(),
        "https://dev-gateway.macro.com/dss",
    );
    assert_eq!(
        service_urls.convert_service_url.as_ref(),
        "https://dev-gateway.macro.com/convert",
    );
    assert_eq!(
        service_urls.search_processing_service_url.as_ref(),
        "https://dev-gateway.macro.com/search-processing",
    );
    assert_eq!(
        service_urls.connection_gateway_url.as_ref(),
        "https://dev-gateway.macro.com/connection-gateway",
    );
    assert_eq!(
        service_urls.connection_gateway_websocket_url.as_ref(),
        "wss://dev-gateway.macro.com/connection-gateway",
    );
    assert_eq!(
        service_urls.document_cognition_service_url.as_ref(),
        "https://dev-gateway.macro.com/cognition",
    );
    assert_eq!(
        service_urls.notification_service_url.as_ref(),
        "https://dev-gateway.macro.com/notification",
    );
    assert_eq!(
        service_urls.static_file_service_url.as_ref(),
        "https://static-file-service-dev.macro.com",
    );
    assert_eq!(
        service_urls.agent_harness_service_url.as_ref(),
        "https://dev-gateway.macro.com/agent-harness",
    );
    assert_eq!(
        service_urls.agent_harness_egress_url.as_ref(),
        "https://dev-gateway.macro.com/agent-harness-egress",
    );
    assert_eq!(
        service_urls.mcp_service_url.as_ref(),
        "https://dev-gateway.macro.com/mcp",
    );
    assert_eq!(
        service_urls.unfurl_service_url.as_ref(),
        "https://dev-gateway.macro.com/unfurl",
    );
    assert_eq!(
        service_urls.contacts_service_url.as_ref(),
        "https://dev-gateway.macro.com/contacts",
    );
    assert_eq!(
        service_urls.email_service_url.as_ref(),
        "https://dev-gateway.macro.com/email",
    );
    assert_eq!(
        service_urls.calendar_service_url.as_ref(),
        "https://dev-gateway.macro.com/calendar",
    );
    assert_eq!(
        service_urls.image_proxy_service_url.as_ref(),
        "https://dev-gateway.macro.com/image-proxy",
    );
    assert_eq!(
        service_urls.lexical_service_url.as_ref(),
        "https://dev-gateway.macro.com/lexical",
    );
    assert_eq!(
        service_urls.sync_service_url.as_ref(),
        "https://sync-service-dev3.macroverse.workers.dev",
    );
}

#[test]
fn exported_service_urls_match_prod_values() {
    let service_urls = ServiceUrls::default_for_environment(macro_env::Environment::Production);

    assert_eq!(service_urls.app_service_url.as_ref(), "https://macro.com");
    assert_eq!(
        service_urls.auth_service_url.as_ref(),
        "https://gateway.macro.com/auth",
    );
    assert_eq!(
        service_urls.document_storage_service_url.as_ref(),
        "https://gateway.macro.com/dss",
    );
    assert_eq!(
        service_urls.convert_service_url.as_ref(),
        "https://gateway.macro.com/convert",
    );
    assert_eq!(
        service_urls.search_processing_service_url.as_ref(),
        "https://gateway.macro.com/search-processing",
    );
    assert_eq!(
        service_urls.connection_gateway_url.as_ref(),
        "https://gateway.macro.com/connection-gateway",
    );
    assert_eq!(
        service_urls.connection_gateway_websocket_url.as_ref(),
        "wss://gateway.macro.com/connection-gateway",
    );
    assert_eq!(
        service_urls.document_cognition_service_url.as_ref(),
        "https://gateway.macro.com/cognition",
    );
    assert_eq!(
        service_urls.notification_service_url.as_ref(),
        "https://gateway.macro.com/notification",
    );
    assert_eq!(
        service_urls.static_file_service_url.as_ref(),
        "https://static-file-service.macro.com",
    );
    assert_eq!(
        service_urls.agent_harness_service_url.as_ref(),
        "https://gateway.macro.com/agent-harness",
    );
    assert_eq!(
        service_urls.agent_harness_egress_url.as_ref(),
        "https://gateway.macro.com/agent-harness-egress",
    );
    assert_eq!(
        service_urls.mcp_service_url.as_ref(),
        "https://gateway.macro.com/mcp",
    );
    assert_eq!(
        service_urls.unfurl_service_url.as_ref(),
        "https://gateway.macro.com/unfurl",
    );
    assert_eq!(
        service_urls.contacts_service_url.as_ref(),
        "https://gateway.macro.com/contacts",
    );
    assert_eq!(
        service_urls.email_service_url.as_ref(),
        "https://gateway.macro.com/email",
    );
    assert_eq!(
        service_urls.calendar_service_url.as_ref(),
        "https://gateway.macro.com/calendar",
    );
    assert_eq!(
        service_urls.image_proxy_service_url.as_ref(),
        "https://gateway.macro.com/image-proxy",
    );
    assert_eq!(
        service_urls.lexical_service_url.as_ref(),
        "https://gateway.macro.com/lexical",
    );
    assert_eq!(
        service_urls.sync_service_url.as_ref(),
        "https://sync-service-prod2.macroverse.workers.dev",
    );
}

#[test]
fn exported_service_url_override_names_are_derived_from_env_var_names() {
    assert_eq!(
        AppServiceUrl::local().override_env_var_name(),
        "OVERRIDE_APP_SERVICE_URL",
    );
    assert_eq!(
        AuthServiceUrl::local().override_env_var_name(),
        "OVERRIDE_AUTH_SERVICE_URL",
    );
    assert_eq!(
        DocumentStorageServiceUrl::local().override_env_var_name(),
        "OVERRIDE_DOCUMENT_STORAGE_SERVICE_URL",
    );
    assert_eq!(
        ConvertServiceUrl::local().override_env_var_name(),
        "OVERRIDE_CONVERT_SERVICE_URL",
    );
    assert_eq!(
        SearchProcessingServiceUrl::local().override_env_var_name(),
        "OVERRIDE_SEARCH_PROCESSING_SERVICE_URL",
    );
    assert_eq!(
        ConnectionGatewayUrl::local().override_env_var_name(),
        "OVERRIDE_CONNECTION_GATEWAY_URL",
    );
    assert_eq!(
        ConnectionGatewayWebsocketUrl::local().override_env_var_name(),
        "OVERRIDE_CONNECTION_GATEWAY_WEBSOCKET_URL",
    );
    assert_eq!(
        DocumentCognitionServiceUrl::local().override_env_var_name(),
        "OVERRIDE_DOCUMENT_COGNITION_SERVICE_URL",
    );
    assert_eq!(
        NotificationServiceUrl::local().override_env_var_name(),
        "OVERRIDE_NOTIFICATION_SERVICE_URL",
    );
    assert_eq!(
        StaticFileServiceUrl::local().override_env_var_name(),
        "OVERRIDE_STATIC_FILE_SERVICE_URL",
    );
    assert_eq!(
        StaticFilePublicUrl::local().override_env_var_name(),
        "OVERRIDE_STATIC_FILE_PUBLIC_URL",
    );
    assert_eq!(
        AgentHarnessEgressUrl::local().override_env_var_name(),
        "OVERRIDE_AGENT_HARNESS_EGRESS_URL",
    );
    assert_eq!(
        McpServiceUrl::local().override_env_var_name(),
        "OVERRIDE_MCP_SERVICE_URL",
    );
    assert_eq!(
        UnfurlServiceUrl::local().override_env_var_name(),
        "OVERRIDE_UNFURL_SERVICE_URL",
    );
    assert_eq!(
        ContactsServiceUrl::local().override_env_var_name(),
        "OVERRIDE_CONTACTS_SERVICE_URL",
    );
    assert_eq!(
        EmailServiceUrl::local().override_env_var_name(),
        "OVERRIDE_EMAIL_SERVICE_URL",
    );
    assert_eq!(
        ImageProxyServiceUrl::local().override_env_var_name(),
        "OVERRIDE_IMAGE_PROXY_SERVICE_URL",
    );
    assert_eq!(
        LexicalServiceUrl::local().override_env_var_name(),
        "OVERRIDE_LEXICAL_SERVICE_URL",
    );
    assert_eq!(
        SyncServiceUrl::local().override_env_var_name(),
        "OVERRIDE_SYNC_SERVICE_URL",
    );
}

#[test]
fn service_url_converts_to_string() {
    let service_url = ServiceUrl::borrowed("https://borrowed.macro.com");
    let url_string: String = service_url.into();

    assert_eq!(url_string, "https://borrowed.macro.com");
}

#[test]
fn connect_api_url_parses() {
    assert_parses_for_all_environments(ConnectApiUrl::default_for_environment);
}