Created
May 1, 2020 00:15
-
-
Save amitgupta15/0992447c15476cd26364f21b8d8ce9a6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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