#![cfg(test)]
use super::{IResolver, orchestrator::LocaleEntry};
use crate::data::store::LocaleProfile;
use crate::data::swap::IRegistryState;
use bistun_core::traits::{Direction, MorphType, NormType, SegType, TransType};
use mockall::mock;
use std::sync::Arc;
mock! {
pub RegistryState {}
impl IRegistryState for RegistryState {
fn get_profile(&self, id: &str) -> Option<Arc<LocaleProfile>>;
fn resolve_alias(&self, tag: &str) -> Option<String>;
fn get_version(&self) -> String;
fn get_base_resource_uri(&self) -> String; }
}
mock! {
pub NextResolver {}
impl IResolver for NextResolver {
fn resolve(&self, tag: &str, state: &dyn IRegistryState, path: &mut Vec<String>) -> Option<LocaleEntry>;
fn set_next(&mut self, next: Box<dyn IResolver>);
}
}
pub fn create_stub(id: &str) -> Arc<LocaleProfile> {
Arc::new(LocaleProfile {
id: id.to_string(),
morph: MorphType::FUSIONAL,
base_seg: SegType::SPACE,
alt_seg: None,
direction: Direction::LTR,
has_bidi: false,
requires_shaping: false,
plurals: vec![],
unicode_blocks: vec![],
normalization: NormType::NFC,
transliteration: TransType::NONE,
required_resource: None,
})
}