Skip to content

Instantly share code, notes, and snippets.

@Loreen-netizen
Last active March 20, 2020 14:18
Show Gist options
  • Save Loreen-netizen/ca545a787f6cc6d915b2e0366fcc3824 to your computer and use it in GitHub Desktop.
Save Loreen-netizen/ca545a787f6cc6d915b2e0366fcc3824 to your computer and use it in GitHub Desktop.
JS Bin// source https://jsbin.com/leqimek
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/3.2.0/mocha.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/3.2.0/mocha.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/3.5.0/chai.min.js"></script>
<div id="mocha"></div>
<script>
// the mocha test style to use - we use BDD - Behviour Driven Development
mocha.setup('bdd');
//ensure the assert function is available
var assert = chai.assert;
</script>
<script id="jsbin-javascript">
// fix this function to make the unit tests pass below
function greet(name) {
// write your code here
return("Hello, "+name)
// write your code above this line
}
// don't change any code below this line
describe("Greet is working fine", function() {
it("should be able to greet Lindani", function() {
assert.equal("Hello, Lindani", greet("Lindani"));
});
it("should be able to greet Siyanda", function() {
assert.equal("Hello, Siyanda", greet("Siyanda"));
});
});
mocha.checkLeaks();
mocha.run();
</script>
<script id="jsbin-source-javascript" type="text/javascript"> // fix this function to make the unit tests pass below
function greet(name) {
// write your code here
return("Hello, "+name)
// write your code above this line
}
// don't change any code below this line
describe("Greet is working fine", function() {
it("should be able to greet Lindani", function() {
assert.equal("Hello, Lindani", greet("Lindani"));
});
it("should be able to greet Siyanda", function() {
assert.equal("Hello, Siyanda", greet("Siyanda"));
});
});
mocha.checkLeaks();
mocha.run();</script></body>
</html>
// fix this function to make the unit tests pass below
function greet(name) {
// write your code here
return("Hello, "+name)
// write your code above this line
}
// don't change any code below this line
describe("Greet is working fine", function() {
it("should be able to greet Lindani", function() {
assert.equal("Hello, Lindani", greet("Lindani"));
});
it("should be able to greet Siyanda", function() {
assert.equal("Hello, Siyanda", greet("Siyanda"));
});
});
mocha.checkLeaks();
mocha.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment