use std::collections::BTreeSet;

use serde_json as json;

#[test]
fn english_and_swedish_localization_bundles_share_the_same_keys() {
    let en: json::Value =
        json::from_str(include_str!("../../contracts/localization/en.json")).unwrap();
    let sv: json::Value =
        json::from_str(include_str!("../../contracts/localization/sv.json")).unwrap();

    let en_keys: BTreeSet<_> = en.as_object().unwrap().keys().cloned().collect();
    let sv_keys: BTreeSet<_> = sv.as_object().unwrap().keys().cloned().collect();

    assert_eq!(en_keys, sv_keys);
    assert!(!en_keys.is_empty());

    for key in &en_keys {
        assert!(
            !en[key].as_str().unwrap().trim().is_empty(),
            "missing English text for {key}"
        );
        assert!(
            !sv[key].as_str().unwrap().trim().is_empty(),
            "missing Swedish text for {key}"
        );
    }
}
