Building a Unit Test in Jasmine, Part 1
My first step in understanding Jasmine. The test has no value in its result. However, using something this simple really helped me to start getting a handle on what Jasmine can do.
by fresheyeball
HTML
<!-- https://github.com/searls/jasmine-all -->
<!DOCTYPE html>
</html>
<head>
<title>Jasmine</title>
</head>
<body>
<span class='bloglink'> Blog entry for this example can be found at <a href="http://randomjavascript.blogspot.com/2012/11/building-unit-test-in-jasmine-part-1.html" target="_blank">Building a Unit Test in Jasmine, Part 1
</a></span>
<script type="text/javascript" src="http://searls.github.com/jasmine-all/jasmine-all-min.js"></script>
CSS
.bloglink{
font-size: 10px;
font-style: italic;
}
JavaScript
describe('Simple Test', function() {
it('2+2=4', function() {
expect(
function() {
return 2 + 2;
}()).toEqual(4);
});
});