Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function nOfFibonacci(x) {
return (!n || n < 1) ? -1 : (n < 3 ? 1 : (nOfFibonacci(n-1) + nOfFibonacci(n-2)));
}

function iThink(thisThing, thatThing) {
return "I think " + thisThing + " but " + thatThing + ".";
}

module.exports = {
sum: sum,
sub: sub,
Expand All @@ -59,5 +63,6 @@ module.exports = {
anomalyCode: anomalyCode,
fahrenheit2Celcius: fahrenheit2Celcius,
power: power,
nOfFibonacci: nOfFibonacci
nOfFibonacci: nOfFibonacci,
iThink: iThink
}
7 changes: 5 additions & 2 deletions sketch.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

const { sum, sub, prod, digital_root, sum42, sayHelloTo, anomalyCode, fahrenheit2Celcius, power, nOfFibonacci } = require('./sketch');
const { sum, sub, prod, digital_root, sum42, sayHelloTo, anomalyCode, fahrenheit2Celcius, power, nOfFibonacci, iThink } = require('./sketch');


const fs = require("fs");
Expand Down Expand Up @@ -121,6 +120,10 @@ test('the 20th number of fibonacci should be 6765', () => {
expect(nOfFibonacci(20)).toBe(6765);
})

test('I think...', () => {
expect(iThink("tests are annoying", "I appreciate them")).toBe("I think tests are annoying but I appreciate them.");
})

const testUrlInMarkdown = (file) => {
let markdown = fs.readFileSync(file).toString();
let urls = [];
Expand Down