mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
feat(admin): upload instance branding images (#3476)
This commit is contained in:
1 parent
52c19e67cb
commit
36095ab66f
7 files changed
+591
-54
No files matched your search
@@ -1281,3 +1281,28 @@ fn deserialize_guild_threads_response() {
|
||||
.is_some_and(|m| m.archived && !m.locked)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn branding_asset_upload_request_matches_the_generated_contract() {
|
||||
for kind in types::BrandingAssetKind::ALL {
|
||||
for image in [Some("data:image/png;base64,iVBORw0KGgo=".to_owned()), None] {
|
||||
let request = types::BrandingAssetUploadRequest {
|
||||
kind,
|
||||
image: image.clone(),
|
||||
};
|
||||
let value = serde_json::to_value(&request).unwrap();
|
||||
assert_eq!(
|
||||
value,
|
||||
serde_json::json!({"kind": kind.as_str(), "image": image})
|
||||
);
|
||||
let generated: generated_types::BrandingAssetUploadRequest =
|
||||
serde_json::from_value(value.clone()).expect("generated branding asset contract");
|
||||
assert_eq!(
|
||||
serde_json::to_value(generated).unwrap()["kind"],
|
||||
value["kind"]
|
||||
);
|
||||
assert_eq!(types::BrandingAssetKind::parse(kind.as_str()), Some(kind));
|
||||
}
|
||||
}
|
||||
assert_eq!(types::BrandingAssetKind::parse("banner"), None);
|
||||
}
|
||||
Reference in new issue
Block a user