Skip to content

Commit

Permalink
Unit testing exercises
Browse files Browse the repository at this point in the history
  • Loading branch information
craigb28 committed Feb 12, 2024
1 parent df0ac01 commit c4bc46d
Show file tree
Hide file tree
Showing 10 changed files with 14,575 additions and 1 deletion.
3,631 changes: 3,631 additions & 0 deletions unit-testing/chapter-examples/hello-jest/package-lock.json

Large diffs are not rendered by default.

3,631 changes: 3,631 additions & 0 deletions unit-testing/chapter-examples/palindrome-example/package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const isPalindrome = require('../palindrome.js');

describe("testing isPalindrome", function(){
test("should return true for a single letter", function(){
expect(isPalindrome("a")).toBe(true);
});
test("should return true for a single letter repeated", function(){
expect(isPalindrome("bbb")).toBe(true);
});
test("should return true for a simple palindome", function(){
expect(isPalindrome("bib")).toBe(true);
});
test("should return true for a longer palindrome", function(){
expect(isPalindrome("racecar")).toBe(true);
});
});
3,631 changes: 3,631 additions & 0 deletions unit-testing/chapter-examples/transmission-processor/package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function processor(transmission) {
return {};
}

module.exports = processor
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
const processor = require("../processor.js");

describe("transmission processor", function() {

test("takes a string and returns an object", function() {
let result = processor("9701::<489584872710>");
expect(typeof(result)).toBe("object");

});
// TODO: put tests here

});
4 changes: 3 additions & 1 deletion unit-testing/exercises/checkFive.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ function checkFive(num){
result = num + " is greater than 5.";
}
return result;
}
}

module.exports = checkFive
Loading

0 comments on commit c4bc46d

Please sign in to comment.