From 674fcf8e56b09db78dccabd7c85d29ec3758df28 Mon Sep 17 00:00:00 2001 From: Tatiana Date: Sat, 8 May 2021 11:31:02 -0700 Subject: [PATCH] Revert "update tests, multiple exercises" This reverts commit 2eb02ea2120f96a122f05cbc84b2fd41d7c43563. --- caesar/caesar.spec.js | 33 ++++++++-------- calculator/calculator.spec.js | 50 ++++++++++++------------- fibonacci/fibonacci.spec.js | 22 +++++------ findTheOldest/findTheOldest.spec.js | 2 +- getTheTitles/getTheTitles.spec.js | 2 +- helloWorld/helloWorld.js | 2 +- helloWorld/helloWorld.spec.js | 15 ++++++-- leapYears/leapYears.spec.js | 3 +- palindromes/palindromes.spec.js | 2 +- pig_latin/pigLatin.spec.js | 2 +- removeFromArray/removeFromArray.spec.js | 2 +- 11 files changed, 72 insertions(+), 63 deletions(-) diff --git a/caesar/caesar.spec.js b/caesar/caesar.spec.js index 5fcc086..24de84c 100644 --- a/caesar/caesar.spec.js +++ b/caesar/caesar.spec.js @@ -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!'); }); }); diff --git a/calculator/calculator.spec.js b/calculator/calculator.spec.js index c07b6ba..0badb08 100644 --- a/calculator/calculator.spec.js +++ b/calculator/calculator.spec.js @@ -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 }); }); diff --git a/fibonacci/fibonacci.spec.js b/fibonacci/fibonacci.spec.js index 06a0e4f..062b8bd 100644 --- a/fibonacci/fibonacci.spec.js +++ b/fibonacci/fibonacci.spec.js @@ -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); }); }); diff --git a/findTheOldest/findTheOldest.spec.js b/findTheOldest/findTheOldest.spec.js index 670a211..04e41c1 100644 --- a/findTheOldest/findTheOldest.spec.js +++ b/findTheOldest/findTheOldest.spec.js @@ -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() { diff --git a/getTheTitles/getTheTitles.spec.js b/getTheTitles/getTheTitles.spec.js index aafc5c6..90d6279 100644 --- a/getTheTitles/getTheTitles.spec.js +++ b/getTheTitles/getTheTitles.spec.js @@ -1,4 +1,4 @@ -let getTheTitles = require('./getTheTitles') +const expect = require('expect');let getTheTitles = require('./getTheTitles') describe('getTheTitles', function() { const books = [ diff --git a/helloWorld/helloWorld.js b/helloWorld/helloWorld.js index a41264d..bdd1356 100644 --- a/helloWorld/helloWorld.js +++ b/helloWorld/helloWorld.js @@ -1,5 +1,5 @@ const helloWorld = function() { - return '' + return 'Yello Wold!' } module.exports = helloWorld diff --git a/helloWorld/helloWorld.spec.js b/helloWorld/helloWorld.spec.js index c98e534..50e69dd 100644 --- a/helloWorld/helloWorld.spec.js +++ b/helloWorld/helloWorld.spec.js @@ -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!"); + }) }); diff --git a/leapYears/leapYears.spec.js b/leapYears/leapYears.spec.js index 2887fe5..5c3a36b 100644 --- a/leapYears/leapYears.spec.js +++ b/leapYears/leapYears.spec.js @@ -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() { diff --git a/palindromes/palindromes.spec.js b/palindromes/palindromes.spec.js index fcd4b6f..0df7b17 100644 --- a/palindromes/palindromes.spec.js +++ b/palindromes/palindromes.spec.js @@ -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() { diff --git a/pig_latin/pigLatin.spec.js b/pig_latin/pigLatin.spec.js index f6c0a47..8bf0952 100644 --- a/pig_latin/pigLatin.spec.js +++ b/pig_latin/pigLatin.spec.js @@ -1,4 +1,4 @@ -// Topics +const expect = require("expect");// Topics // * modules // * strings diff --git a/removeFromArray/removeFromArray.spec.js b/removeFromArray/removeFromArray.spec.js index 879d8b6..32a498b 100644 --- a/removeFromArray/removeFromArray.spec.js +++ b/removeFromArray/removeFromArray.spec.js @@ -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() {