{"action":"closed","issue":{"url":"https://api.github.com/repos/bespoken/virtual-alexa/issues/9","repository_url":"https://api.github.com/repos/bespoken/virtual-alexa","labels_url":"https://api.github.com/repos/bespoken/virtual-alexa/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/bespoken/virtual-alexa/issues/9/comments","events_url":"https://api.github.com/repos/bespoken/virtual-alexa/issues/9/events","html_url":"https://github.com/bespoken/virtual-alexa/issues/9","id":273040461,"number":9,"title":"Add reply wrapper, so that emulator can easily be used with assertion frameworks","user":{"login":"jkelvie","id":17267,"avatar_url":"https://avatars0.githubusercontent.com/u/17267?v=4","gravatar_id":"","url":"https://api.github.com/users/jkelvie","html_url":"https://github.com/jkelvie","followers_url":"https://api.github.com/users/jkelvie/followers","following_url":"https://api.github.com/users/jkelvie/following{/other_user}","gists_url":"https://api.github.com/users/jkelvie/gists{/gist_id}","starred_url":"https://api.github.com/users/jkelvie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkelvie/subscriptions","organizations_url":"https://api.github.com/users/jkelvie/orgs","repos_url":"https://api.github.com/users/jkelvie/repos","events_url":"https://api.github.com/users/jkelvie/events{/privacy}","received_events_url":"https://api.github.com/users/jkelvie/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-11-10T19:50:53Z","updated_at":"2018-05-16T19:02:22Z","closed_at":"2018-05-16T19:02:22Z","author_association":"MEMBER","body":"**Overview**\r\nCreate a reply wrapper, which adds convenience methods to the reply payload for testing and other uses.\r\n\r\n**Rationale**\r\nWe prefer a reply wrapper to building on our own expectations/assertions because there are already many fine assertion frameworks out there. However, making it easy to get data from the JSON response for Alexa is very useful\r\n\r\n**Example**\r\nHere is an example of how it might work that uses Jest:\r\n```\r\nreply = ReplyAdapter.tranform(reply); // Adds helper methods\r\nexpect(reply.ssml()).toContain(\"<audio src=\\\"http://jpk.com\"\\\" />\");\r\nexpect(reply.plainText()).toBeUndefined();\r\n```\r\n\r\n**Useful methods**\r\n```\r\nattr(key) - The session attribute - undefined if it does not exist\r\ncard() - The card - an object unto itself with properties for image\r\nplainText() - The plain text reply - if it exists, undefined if not\r\nreprompt() - The reprompt text - if it exists, undefined if not\r\nssml() - The SSML payload - undefined if it does not exist\r\n```\r\n\r\nThis is a subset - we can identify more.\r\n\r\nInfluenced by this issue:\r\nhttps://github.com/jovotech/jovo-framework-nodejs/issues/39"}}
{"actor":{"display_login":"jkelvie"}}