aboutsummaryrefslogtreecommitdiff
path: root/tests/test_create_embed.rs
diff options
context:
space:
mode:
authorMishio595 <[email protected]>2018-08-01 15:38:12 -0600
committerMishio595 <[email protected]>2018-08-01 15:38:12 -0600
commitc5fb7b4b331ef5a66179539b065913078e55b668 (patch)
tree99bc28270eaad9acf3da3871e72ba67dac5b87eb /tests/test_create_embed.rs
parentMerge branch 'asref_messageid_for_message' (diff)
parentDon't delay Ready with cache enabled (diff)
downloadserenity-c5fb7b4b331ef5a66179539b065913078e55b668.tar.xz
serenity-c5fb7b4b331ef5a66179539b065913078e55b668.zip
Merge branch 'upstream'
Diffstat (limited to 'tests/test_create_embed.rs')
-rw-r--r--tests/test_create_embed.rs92
1 files changed, 0 insertions, 92 deletions
diff --git a/tests/test_create_embed.rs b/tests/test_create_embed.rs
deleted file mode 100644
index 5bdce5f..0000000
--- a/tests/test_create_embed.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
-#![cfg(all(feature = "builder", feature = "utils"))]
-
-#[macro_use]
-extern crate serde_json;
-extern crate serenity;
-
-use serde_json::Value;
-use serenity::model::channel::{Embed, EmbedField, EmbedFooter, EmbedImage, EmbedVideo};
-use serenity::builder::CreateEmbed;
-use serenity::utils::{self, Colour};
-
-#[test]
-fn test_from_embed() {
- let embed = Embed {
- author: None,
- colour: Colour::new(0xFF0011),
- description: Some("This is a test description".to_string()),
- fields: vec![
- EmbedField {
- inline: false,
- name: "a".to_string(),
- value: "b".to_string(),
- },
- EmbedField {
- inline: true,
- name: "c".to_string(),
- value: "z".to_string(),
- },
- ],
- footer: Some(EmbedFooter {
- icon_url: Some("https://i.imgur.com/XfWpfCV.gif".to_string()),
- proxy_icon_url: None,
- text: "This is a hakase footer".to_string(),
- }),
- image: Some(EmbedImage {
- height: 213,
- proxy_url: "a".to_string(),
- url: "https://i.imgur.com/XfWpfCV.gif".to_string(),
- width: 224,
- }),
- kind: "rich".to_string(),
- provider: None,
- thumbnail: None,
- timestamp: None,
- title: Some("hakase".to_string()),
- url: Some("https://i.imgur.com/XfWpfCV.gif".to_string()),
- video: Some(EmbedVideo {
- height: 213,
- url: "https://i.imgur.com/XfWpfCV.mp4".to_string(),
- width: 224,
- }),
- };
-
- let builder = CreateEmbed::from(embed)
- .colour(0xFF0011)
- .description("This is a hakase description")
- .image("https://i.imgur.com/XfWpfCV.gif")
- .title("still a hakase")
- .url("https://i.imgur.com/XfWpfCV.gif");
-
- let built = Value::Object(utils::vecmap_to_json_map(builder.0));
-
- let obj = json!({
- "color": 0xFF0011,
- "description": "This is a hakase description",
- "title": "still a hakase",
- "type": "rich",
- "url": "https://i.imgur.com/XfWpfCV.gif",
- "fields": [
- {
- "inline": false,
- "name": "a",
- "value": "b",
- },
- {
- "inline": true,
- "name": "c",
- "value": "z",
- },
- ],
- "image": {
- "url": "https://i.imgur.com/XfWpfCV.gif",
- },
- "footer": {
- "text": "This is a hakase footer",
- "icon_url": "https://i.imgur.com/XfWpfCV.gif",
- }
- });
-
- assert_eq!(built, obj);
-}