Revert "update tests, multiple exercises"

This reverts commit 2eb02ea212.
This commit is contained in:
Tatiana 2021-05-08 11:31:02 -07:00
parent eec196df17
commit 674fcf8e56
11 changed files with 72 additions and 63 deletions

View file

@ -1,25 +1,26 @@
const caesar = require("./caesar"); const expect = require('expect');
const caesar = require('./caesar')
describe("caesar", function () { describe('caesar', function() {
it("works with single letters", function () { test('works with single letters', function() {
expect(caesar("A", 1)).toEqual("B"); expect(caesar('A', 1)).toBe('B');
}); });
xit("works with words", function () { test.skip('works with words', function() {
expect(caesar("Aaa", 1)).toEqual("Bbb"); expect(caesar('Aaa', 1)).toBe('Bbb');
}); });
xit("works with phrases", function () { test.skip('works with phrases', function() {
expect(caesar("Hello, World!", 5)).toEqual("Mjqqt, Btwqi!"); expect(caesar('Hello, World!', 5)).toBe('Mjqqt, Btwqi!');
}); });
xit("works with negative shift", function () { test.skip('works with negative shift', function() {
expect(caesar("Mjqqt, Btwqi!", -5)).toEqual("Hello, World!"); expect(caesar('Mjqqt, Btwqi!', -5)).toBe('Hello, World!');
}); });
xit("wraps", function () { test.skip('wraps', function() {
expect(caesar("Z", 1)).toEqual("A"); expect(caesar('Z', 1)).toBe('A');
}); });
xit("works with large shift factors", function () { test.skip('works with large shift factors', function() {
expect(caesar("Hello, World!", 75)).toEqual("Ebiil, Tloia!"); expect(caesar('Hello, World!', 75)).toBe('Ebiil, Tloia!');
}); });
xit("works with large negative shift factors", function () { test.skip('works with large negative shift factors', function() {
expect(caesar("Hello, World!", -29)).toEqual("Ebiil, Tloia!"); expect(caesar('Hello, World!', -29)).toBe('Ebiil, Tloia!');
}); });
}); });

View file

@ -1,56 +1,56 @@
const calculator = require ('./calculator.js'); const expect = require('expect');const calculator = require ('./calculator.js');
describe('add', function() { describe('add', function() {
it('adds 0 and 0', function() { it('adds 0 and 0', function() {
expect(calculator.add(0,0)).toEqual(0); expect(calculator.add(0,0)).toEqual(0);
}); });
test.skip('adds 2 and 2', () => { xit('adds 2 and 2', function() {
expect(calculator.add(2,2)).toBe(4); expect(calculator.add(2,2)).toEqual(4);
}); });
test.skip('adds positive numbers', () => { xit('adds positive numbers', function() {
expect(calculator.add(2,6)).toBe(8); expect(calculator.add(2,6)).toEqual(8);
}); });
}); });
describe('subtract', () => { describe('subtract', function() {
test.skip('subtracts numbers', () => { xit('subtracts numbers', function() {
expect(calculator.subtract(10,4)).toBe(6); expect(calculator.subtract(10,4)).toEqual(6);
}); });
}); });
describe('sum', () => { describe('sum', function() {
test.skip('computes the sum of an empty array', () => { xit('computes the sum of an empty array', function() {
expect(calculator.sum([])).toBe(0); expect(calculator.sum([])).toEqual(0);
}); });
test.skip('computes the sum of an array of one number', () => { xit('computes the sum of an array of one number', function() {
expect(calculator.sum([7])).toBe(7); expect(calculator.sum([7])).toEqual(7);
}); });
test.skip('computes the sum of an array of two numbers', () => { xit('computes the sum of an array of two numbers', function() {
expect(calculator.sum([7,11])).toBe(18); expect(calculator.sum([7,11])).toEqual(18);
}); });
test.skip('computes the sum of an array of many numbers', () => { xit('computes the sum of an array of many numbers', function() {
expect(calculator.sum([1,3,5,7,9])).toBe(25); expect(calculator.sum([1,3,5,7,9])).toEqual(25);
}); });
}); });
describe('multiply', () => { describe('multiply', function() {
test.skip('multiplies two numbers', () => { xit('multiplies two numbers', function() {
expect(calculator.multiply([2,4])).toBe(8); expect(calculator.multiply([2,4])).toEqual(8);
}); });
test.skip('multiplies several numbers', () => { xit('multiplies several numbers', function() {
expect(calculator.multiply([2,4,6,8,10,12,14])).toBe(645120); expect(calculator.multiply([2,4,6,8,10,12,14])).toEqual(645120);
}); });
}); });
describe('power', () => { describe('power', function() {
test.skip('raises one number to the power of another number', () => { xit('raises one number to the power of another number', function() {
expect(calculator.power(4,3)).toBe(64); // 4 to third power is 64 expect(calculator.power(4,3)).toEqual(64); // 4 to third power is 64
}); });
}); });

View file

@ -1,31 +1,31 @@
const fibonacci = require("./fibonacci"); const expect = require('expect');const fibonacci = require('./fibonacci')
describe("fibonacci", function () { describe('fibonacci', function() {
it("works", function () { it('works', function() {
expect(fibonacci(4)).toEqual(3); expect(fibonacci(4)).toEqual(3);
}); });
xit("works", function () { xit('works', function() {
expect(fibonacci(6)).toEqual(8); expect(fibonacci(6)).toEqual(8);
}); });
xit("works", function () { xit('works', function() {
expect(fibonacci(10)).toEqual(55); expect(fibonacci(10)).toEqual(55);
}); });
xit("works", function () { xit('works', function() {
expect(fibonacci(15)).toEqual(610); expect(fibonacci(15)).toEqual(610);
}); });
xit("works", function () { xit('works', function() {
expect(fibonacci(25)).toEqual(75025); expect(fibonacci(25)).toEqual(75025);
}); });
xit("doesn't accept negatives", function () { xit('doesn\'t accept negatives', function() {
expect(fibonacci(-25)).toEqual("OOPS"); expect(fibonacci(-25)).toEqual("OOPS");
}); });
xit("DOES accept strings", function () { xit('DOES accept strings', function() {
expect(fibonacci("1")).toEqual(1); expect(fibonacci("1")).toEqual(1);
}); });
xit("DOES accept strings", function () { xit('DOES accept strings', function() {
expect(fibonacci("2")).toEqual(1); expect(fibonacci("2")).toEqual(1);
}); });
xit("DOES accept strings", function () { xit('DOES accept strings', function() {
expect(fibonacci("8")).toEqual(21); expect(fibonacci("8")).toEqual(21);
}); });
}); });

View file

@ -1,4 +1,4 @@
let findTheOldest = require('./findTheOldest') const expect = require('expect');let findTheOldest = require('./findTheOldest')
describe('findTheOldest', function() { describe('findTheOldest', function() {
it('finds the oldest person!', function() { it('finds the oldest person!', function() {

View file

@ -1,4 +1,4 @@
let getTheTitles = require('./getTheTitles') const expect = require('expect');let getTheTitles = require('./getTheTitles')
describe('getTheTitles', function() { describe('getTheTitles', function() {
const books = [ const books = [

View file

@ -1,5 +1,5 @@
const helloWorld = function() { const helloWorld = function() {
return '' return 'Yello Wold!'
} }
module.exports = helloWorld module.exports = helloWorld

View file

@ -1,7 +1,14 @@
const expect = require('expect');
const helloWorld = require('./helloWorld'); const helloWorld = require('./helloWorld');
describe('Hello World', function() { // describe('Hello World', function() {
it('says hello world', function() { // it('says hello world', function() {
expect(helloWorld()).toEqual('Hello, World!'); // expect(helloWorld()).toEqual('Hello, World!');
}); // });
// });
describe('helloWorld', function() {
test('says "Hello, World!"', function() {
expect(helloWorld()).toBe("Hello, World!");
})
}); });

View file

@ -1,4 +1,5 @@
const leapYears = require("./leapYears"); const expect = require('expect');
const leapYears = require('./leapYears')
describe('leapYears', function() { describe('leapYears', function() {
it('works with non century years', function() { it('works with non century years', function() {

View file

@ -1,4 +1,4 @@
const palindromes = require("./palindromes"); const expect = require('expect');const palindromes = require('./palindromes')
describe('palindromes', function() { describe('palindromes', function() {
it('works with single words', function() { it('works with single words', function() {

View file

@ -1,4 +1,4 @@
// Topics const expect = require("expect");// Topics
// * modules // * modules
// * strings // * strings

View file

@ -1,4 +1,4 @@
const removeFromArray = require("./removeFromArray"); const expect = require('expect');const removeFromArray = require('./removeFromArray')
describe('removeFromArray', function() { describe('removeFromArray', function() {
it('removes a single value', function() { it('removes a single value', function() {