Created
January 28, 2015 00:53
-
-
Save PandaWhisperer/cb939045fc5e84bf9533 to your computer and use it in GitHub Desktop.
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
{discover} = require "pbx/client" | |
amen = require "amen" | |
assert = require "assert" | |
amen.describe "One-time message pad", (context) -> | |
context.test "Create a message", (context) -> | |
api = yield discover "http://localhost:8080" | |
{response: {headers: {location}}} = | |
(yield api.messages.create content: "Test Message") | |
message = (api.message location) | |
context.test "Retrieve a message", -> | |
{data} = yield message.get() | |
{content} = yield data | |
assert.equal content, "Test Message" | |
context.test "Retrieving a message deletes it", -> | |
try | |
yield message.get() | |
catch e | |
assert e.message.match /404/ | |
return true | |
assert false, "Expected Error, but none was thrown" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just ran this and it worked fine: