Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amitgupta15/0992447c15476cd26364f21b8d8ce9a6 to your computer and use it in GitHub Desktop.
Save amitgupta15/0992447c15476cd26364f21b8d8ce9a6 to your computer and use it in GitHub Desktop.
it('should get render user details object', function () {
// Stub the get function
$myapp.get = function (url, callback) {
if (url === '/api/users?id=1') {
callback({ fname: 'Amit', lname: 'Gupta' });
} else {
callback(false);
}
};
// Attach #user-detail div to the test dom
var selector = document.querySelector('#selector');
selector.innerHTML = '<div id="user-detail"></div>';
$myapp.getUser(1);
assert(selector.innerHTML.includes('Amit Gupta'));
selector.innerHTML = '';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment