Skip to content

Instantly share code, notes, and snippets.

@Pholisa-Fatyela
Created March 20, 2020 15:06
Show Gist options
  • Save Pholisa-Fatyela/c9a52d7667fd6c2bff654d2a7473c35b to your computer and use it in GitHub Desktop.
Save Pholisa-Fatyela/c9a52d7667fd6c2bff654d2a7473c35b to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/weqakip
<!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