aboutsummaryrefslogtreecommitdiff
path: root/import
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-05-03 11:53:50 +0200
committermetamuffin <metamuffin@disroot.org>2025-05-03 11:53:50 +0200
commit0a5c23757c2a0fc8784ea1b5a3ad5b0cba0709e0 (patch)
treefb26033fb934cfe87d36679d7fdeb9b71a1e114a /import
parentf413b4087f214a9cb5d014fec59ae07468155bdd (diff)
downloadjellything-0a5c23757c2a0fc8784ea1b5a3ad5b0cba0709e0.tar
jellything-0a5c23757c2a0fc8784ea1b5a3ad5b0cba0709e0.tar.bz2
jellything-0a5c23757c2a0fc8784ea1b5a3ad5b0cba0709e0.tar.zst
tests in some places
Diffstat (limited to 'import')
-rw-r--r--import/asset_token/src/lib.rs13
-rw-r--r--import/fallback_generator/src/lib.rs5
2 files changed, 17 insertions, 1 deletions
diff --git a/import/asset_token/src/lib.rs b/import/asset_token/src/lib.rs
index de7d2be..7334076 100644
--- a/import/asset_token/src/lib.rs
+++ b/import/asset_token/src/lib.rs
@@ -48,7 +48,7 @@ static ASSET_KEY: LazyLock<Aes256GcmSiv> = LazyLock::new(|| {
}
});
-#[derive(Debug, Encode, Decode, Serialize)]
+#[derive(Debug, Encode, Decode, Serialize, PartialEq, Eq)]
pub enum AssetInner {
Federated { host: String, asset: Vec<u8> },
Cache(CachePath),
@@ -101,3 +101,14 @@ impl AssetInner {
matches!(self, Self::Federated { .. })
}
}
+
+#[test]
+fn test_identities() {
+ *CONF_PRELOAD.lock().unwrap() = Some(Config { asset_key: None });
+
+ let a = AssetInner::Assets(PathBuf::new());
+ let b = a.ser();
+ let c = AssetInner::deser(&b.0).unwrap();
+
+ assert_eq!(a, c)
+}
diff --git a/import/fallback_generator/src/lib.rs b/import/fallback_generator/src/lib.rs
index efb6579..eef40fe 100644
--- a/import/fallback_generator/src/lib.rs
+++ b/import/fallback_generator/src/lib.rs
@@ -101,3 +101,8 @@ fn random_accent(text: &str, y: f32) -> Rgba<f32> {
v *= 0.2;
Rgba([y - u * 0.5 - v * 0.5, y + v, y + u, 1.])
}
+
+#[test]
+fn generate_fallback_test() {
+ generate_fallback("Hello world!", &mut Vec::new()).unwrap();
+}