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 () {
it("works with single letters", function () {
expect(caesar("A", 1)).toEqual("B");
describe('caesar', function() {
test('works with single letters', function() {
expect(caesar('A', 1)).toBe('B');
});
xit("works with words", function () {
expect(caesar("Aaa", 1)).toEqual("Bbb");
test.skip('works with words', function() {
expect(caesar('Aaa', 1)).toBe('Bbb');
});
xit("works with phrases", function () {
expect(caesar("Hello, World!", 5)).toEqual("Mjqqt, Btwqi!");
test.skip('works with phrases', function() {
expect(caesar('Hello, World!', 5)).toBe('Mjqqt, Btwqi!');
});
xit("works with negative shift", function () {
expect(caesar("Mjqqt, Btwqi!", -5)).toEqual("Hello, World!");
test.skip('works with negative shift', function() {
expect(caesar('Mjqqt, Btwqi!', -5)).toBe('Hello, World!');
});
xit("wraps", function () {
expect(caesar("Z", 1)).toEqual("A");
test.skip('wraps', function() {
expect(caesar('Z', 1)).toBe('A');
});
xit("works with large shift factors", function () {
expect(caesar("Hello, World!", 75)).toEqual("Ebiil, Tloia!");
test.skip('works with large shift factors', function() {
expect(caesar('Hello, World!', 75)).toBe('Ebiil, Tloia!');
});
xit("works with large negative shift factors", function () {
expect(caesar("Hello, World!", -29)).toEqual("Ebiil, Tloia!");
test.skip('works with large negative shift factors', function() {
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() {
it('adds 0 and 0', function() {
expect(calculator.add(0,0)).toEqual(0);
});
test.skip('adds 2 and 2', () => {
expect(calculator.add(2,2)).toBe(4);
xit('adds 2 and 2', function() {
expect(calculator.add(2,2)).toEqual(4);
});
test.skip('adds positive numbers', () => {
expect(calculator.add(2,6)).toBe(8);
xit('adds positive numbers', function() {
expect(calculator.add(2,6)).toEqual(8);
});
});
describe('subtract', () => {
test.skip('subtracts numbers', () => {
expect(calculator.subtract(10,4)).toBe(6);
describe('subtract', function() {
xit('subtracts numbers', function() {
expect(calculator.subtract(10,4)).toEqual(6);
});
});
describe('sum', () => {
test.skip('computes the sum of an empty array', () => {
expect(calculator.sum([])).toBe(0);
describe('sum', function() {
xit('computes the sum of an empty array', function() {
expect(calculator.sum([])).toEqual(0);
});
test.skip('computes the sum of an array of one number', () => {
expect(calculator.sum([7])).toBe(7);
xit('computes the sum of an array of one number', function() {
expect(calculator.sum([7])).toEqual(7);
});
test.skip('computes the sum of an array of two numbers', () => {
expect(calculator.sum([7,11])).toBe(18);
xit('computes the sum of an array of two numbers', function() {
expect(calculator.sum([7,11])).toEqual(18);
});
test.skip('computes the sum of an array of many numbers', () => {
expect(calculator.sum([1,3,5,7,9])).toBe(25);
xit('computes the sum of an array of many numbers', function() {
expect(calculator.sum([1,3,5,7,9])).toEqual(25);
});
});
describe('multiply', () => {
test.skip('multiplies two numbers', () => {
expect(calculator.multiply([2,4])).toBe(8);
describe('multiply', function() {
xit('multiplies two numbers', function() {
expect(calculator.multiply([2,4])).toEqual(8);
});
test.skip('multiplies several numbers', () => {
expect(calculator.multiply([2,4,6,8,10,12,14])).toBe(645120);
xit('multiplies several numbers', function() {
expect(calculator.multiply([2,4,6,8,10,12,14])).toEqual(645120);
});
});
describe('power', () => {
test.skip('raises one number to the power of another number', () => {
expect(calculator.power(4,3)).toBe(64); // 4 to third power is 64
describe('power', function() {
xit('raises one number to the power of another number', function() {
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 () {
it("works", function () {
describe('fibonacci', function() {
it('works', function() {
expect(fibonacci(4)).toEqual(3);
});
xit("works", function () {
xit('works', function() {
expect(fibonacci(6)).toEqual(8);
});
xit("works", function () {
xit('works', function() {
expect(fibonacci(10)).toEqual(55);
});
xit("works", function () {
xit('works', function() {
expect(fibonacci(15)).toEqual(610);
});
xit("works", function () {
xit('works', function() {
expect(fibonacci(25)).toEqual(75025);
});
xit("doesn't accept negatives", function () {
xit('doesn\'t accept negatives', function() {
expect(fibonacci(-25)).toEqual("OOPS");
});
xit("DOES accept strings", function () {
xit('DOES accept strings', function() {
expect(fibonacci("1")).toEqual(1);
});
xit("DOES accept strings", function () {
xit('DOES accept strings', function() {
expect(fibonacci("2")).toEqual(1);
});
xit("DOES accept strings", function () {
xit('DOES accept strings', function() {
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() {
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() {
const books = [

View File

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

View File

@ -1,7 +1,14 @@
const expect = require('expect');
const helloWorld = require('./helloWorld');
describe('Hello World', function() {
it('says hello world', function() {
expect(helloWorld()).toEqual('Hello, World!');
});
// describe('Hello World', function() {
// it('says hello world', function() {
// 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() {
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() {
it('works with single words', function() {

View File

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

View File

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