-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from valgaze/add_data
add addData to SpeedyCard
- Loading branch information
Showing
4 changed files
with
137 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import test from "tape"; | ||
import {SpeedyCard} from './../src' | ||
|
||
test("setup", function (t) { | ||
t.end(); | ||
}); | ||
|
||
test("Sanity test", (t) => { | ||
const expected = { | ||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json", | ||
"type": "AdaptiveCard", | ||
"version": "1.0", | ||
"body": [{ | ||
"type": "TextBlock", | ||
"text": "System is 👍", | ||
"weight": "Bolder", | ||
"size": "Large", | ||
"wrap": true | ||
}] | ||
} | ||
const cardPayload = new SpeedyCard().setTitle('System is 👍') | ||
|
||
|
||
const actual = cardPayload.render() | ||
t.deepEqual(actual, expected); | ||
t.end(); | ||
}); | ||
|
||
test("Kitchen sink", (t) => { | ||
const expected = { | ||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json", | ||
"type": "AdaptiveCard", | ||
"version": "1.0", | ||
"body": [{ | ||
"type": "TextBlock", | ||
"text": "System is 👍", | ||
"weight": "Bolder", | ||
"size": "Large", | ||
"wrap": true | ||
}, { | ||
"type": "TextBlock", | ||
"text": "If you see this card, everything is working", | ||
"size": "Small", | ||
"isSubtle": true, | ||
"wrap": true, | ||
"weight": "Lighter" | ||
}, { | ||
"type": "FactSet", | ||
"facts": [{ | ||
"title": "Bot's Uptime", | ||
"value": "12.492006583s" | ||
}] | ||
}, { | ||
"type": "Image", | ||
"url": "https://i.imgur.com/SW78JRd.jpg", | ||
"horizontalAlignment": "Center", | ||
"size": "Large" | ||
}, { | ||
"type": "Input.Text", | ||
"placeholder": "What's on your mind?", | ||
"id": "inputData" | ||
}], | ||
"actions": [{ | ||
"type": "Action.Submit", | ||
"title": "Submit", | ||
"data": { | ||
"mySpecialData": { | ||
"a": 1, | ||
"b": 2 | ||
} | ||
} | ||
}] | ||
} | ||
|
||
const cardPayload = new SpeedyCard().setTitle('System is 👍') | ||
.setSubtitle('If you see this card, everything is working') | ||
.setImage('https://i.imgur.com/SW78JRd.jpg') | ||
.setInput(`What's on your mind?`) | ||
.setTable([["Bot's Uptime", `12.492006583s`]]) | ||
.setData({mySpecialData: { a:1,b:2}}) | ||
|
||
const actual = cardPayload.render() | ||
t.deepEqual(actual, expected); | ||
t.end(); | ||
}); | ||
|
||
test("teardown", function (t) { | ||
t.end(); | ||
}); |