Skip to content

upto date #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/__tests__/arrays.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const {
describe('getNthElement', () => {
const array = ['cat', 'dog', 'elephant', 'fox'];

xit('returns the element at the given position', () => {
it('returns the element at the given position', () => {
expect(getNthElement(0, array)).toEqual('cat');
expect(getNthElement(2, array)).toEqual('elephant');
expect(getNthElement(3, array)).toEqual('fox');
Expand Down
30 changes: 15 additions & 15 deletions src/__tests__/booleans.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ const {
} = require('../booleans');

describe('negate', () => {
xit('returns the opposite of the passed boolean value', () => {
it('returns the opposite of the passed boolean value', () => {
expect(negate(true)).toBe(false);
expect(negate(false)).toBe(true);
});
});

describe('both', () => {
xit('returns true if both of the given booleans are true', () => {
it('returns true if both of the given booleans are true', () => {
expect(both(true, true)).toBe(true);
expect(both(true, false)).toBe(false);
expect(both(false, true)).toBe(false);
expect(both(false, false)).toBe(false);
});
});
})

describe('either', () => {
xit('returns true if at least one of the given booleans are true', () => {
it('returns true if at least one of the given booleans are true', () => {
expect(either(true, true)).toBe(true);
expect(either(true, false)).toBe(true);
expect(either(false, true)).toBe(true);
Expand All @@ -42,7 +42,7 @@ describe('either', () => {
});

describe('none', () => {
xit('returns true if neither of the given booleans are true', () => {
it('returns true if neither of the given booleans are true', () => {
expect(none(true, true)).toBe(false);
expect(none(true, false)).toBe(false);
expect(none(false, true)).toBe(false);
Expand All @@ -51,7 +51,7 @@ describe('none', () => {
});

describe('one', () => {
xit('returns true if exactly one of the given booleans are true', () => {
it('returns true if exactly one of the given booleans are true', () => {
expect(one(true, true)).toBe(false);
expect(one(true, false)).toBe(true);
expect(one(false, true)).toBe(true);
Expand All @@ -74,7 +74,7 @@ describe('truthiness', () => {
});

describe('isEqual', () => {
xit('returns whether the two values are equal', () => {
it('returns whether the two values are equal', () => {
expect(isEqual(true, false)).toBe(false);
expect(isEqual(true, true)).toBe(true);
expect(isEqual('true', 'true')).toBe(true);
Expand All @@ -86,7 +86,7 @@ describe('isEqual', () => {
});

describe('isGreaterThan', () => {
xit('returns true if the first number is strictly greater than the second', () => {
it('returns true if the first number is strictly greater than the second', () => {
expect(isGreaterThan(1, 2)).toBe(false);
expect(isGreaterThan(3, 2)).toBe(true);
expect(isGreaterThan(4, 4)).toBe(false);
Expand All @@ -98,7 +98,7 @@ describe('isGreaterThan', () => {
});

describe('isLessThanOrEqualTo', () => {
xit('returns true if the first number is less than or equal to the second', () => {
it('returns true if the first number is less than or equal to the second', () => {
expect(isLessThanOrEqualTo(1, 2)).toBe(true);
expect(isLessThanOrEqualTo(3, 2)).toBe(false);
expect(isLessThanOrEqualTo(4, 4)).toBe(true);
Expand All @@ -108,7 +108,7 @@ describe('isLessThanOrEqualTo', () => {
});

describe('isOdd', () => {
xit('returns whether the number is odd', () => {
it('returns whether the number is odd', () => {
expect(isOdd(5)).toBe(true);
expect(isOdd(6)).toBe(false);
expect(isOdd(7)).toBe(true);
Expand All @@ -117,7 +117,7 @@ describe('isOdd', () => {
});

describe('isEven', () => {
xit('returns whether the number is even', () => {
it('returns whether the number is even', () => {
expect(isEven(5)).toBe(false);
expect(isEven(6)).toBe(true);
expect(isEven(7)).toBe(false);
Expand All @@ -126,7 +126,7 @@ describe('isEven', () => {
});

describe('isSquare', () => {
xit('returns true if the number is a square', () => {
it('returns true if the number is a square', () => {
expect(isSquare(9)).toEqual(true);
expect(isSquare(4)).toEqual(true);
expect(isSquare(5)).toEqual(false);
Expand All @@ -136,7 +136,7 @@ describe('isSquare', () => {
});

describe('startsWith', () => {
xit('returns whether the given string starts with the given character', () => {
it('returns whether the given string starts with the given character', () => {
expect(startsWith('a', 'aardvark')).toBe(true);
expect(startsWith('c', 'aardvark')).toBe(false);
expect(startsWith('b', 'baardvark')).toBe(true);
Expand All @@ -146,15 +146,15 @@ describe('startsWith', () => {
});

describe('containsVowels', () => {
xit('returns whether the given string contains vowels', () => {
it('returns whether the given string contains vowels', () => {
expect(containsVowels('cat')).toBe(true);
expect(containsVowels('DOG')).toBe(true);
expect(containsVowels('why')).toBe(false);
});
});

describe('isLowerCase', () => {
xit('it returns true if the given string is lowercase', () => {
it('it returns true if the given string is lowercase', () => {
expect(isLowerCase('abc')).toBe(true);
expect(isLowerCase('abc213')).toBe(true);
expect(isLowerCase('Abc')).toBe(false);
Expand Down
22 changes: 11 additions & 11 deletions src/__tests__/numbers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {
} = require('../numbers');

describe('add', () => {
xit('adds the two numbers together', () => {
it('adds the two numbers together', () => {
expect(add(2, 1)).toEqual(3);
expect(add(15, 76)).toEqual(91);
expect(add(12, 0)).toEqual(12);
Expand All @@ -22,7 +22,7 @@ describe('add', () => {
});

describe('subtract', () => {
xit('subtracts the second number from the first', () => {
it('subtracts the second number from the first', () => {
expect(subtract(2, 1)).toEqual(1);
expect(subtract(1, 2)).toEqual(-1);
expect(subtract(-2, 1)).toEqual(-3);
Expand All @@ -32,15 +32,15 @@ describe('subtract', () => {
});

describe('multiply', () => {
xit('multiplies the two numbers together', () => {
it('multiplies the two numbers together', () => {
expect(multiply(10, 3)).toEqual(30);
expect(multiply(-11, 5)).toEqual(-55);
expect(multiply(-4, -9)).toEqual(36);
});
});

describe('divide', () => {
xit('divides the first number by the second number', () => {
it('divides the first number by the second number', () => {
expect(divide(20, 5)).toEqual(4);
expect(divide(5, 2)).toEqual(2.5);
expect(divide(2, 5)).toEqual(0.4);
Expand All @@ -49,39 +49,39 @@ describe('divide', () => {
});

describe('power', () => {
xit('returns the first number to the power of the second', () => {
it('returns the first number to the power of the second', () => {
expect(power(5, 2)).toEqual(25);
expect(power(2, 3)).toEqual(8);
expect(power(10, 5)).toEqual(100000);
});
});

describe('round', () => {
xit('rounds the number to the nearest integer', () => {
it('rounds the number to the nearest integer', () => {
expect(round(2.1)).toEqual(2);
expect(round(9.7)).toEqual(10);
expect(round(5.5)).toEqual(6);
});
});

describe('roundUp', () => {
xit('rounds the number up to the nearest integer', () => {
it('rounds the number up to the nearest integer', () => {
expect(roundUp(2.1)).toEqual(3);
expect(roundUp(9.7)).toEqual(10);
expect(roundUp(5.5)).toEqual(6);
});
});

describe('roundDown', () => {
xit('rounds the number down to the nearest integer', () => {
it('rounds the number down to the nearest integer', () => {
expect(roundDown(2.1)).toEqual(2);
expect(roundDown(9.7)).toEqual(9);
expect(roundDown(5.5)).toEqual(5);
});
});

describe('absolute', () => {
xit('returns the absolute value of the number', () => {
it('returns the absolute value of the number', () => {
expect(absolute(-1)).toEqual(1);
expect(absolute(1)).toEqual(1);
expect(absolute(0)).toEqual(0);
Expand All @@ -93,7 +93,7 @@ describe('quotient', () => {
// the first by the second, without the remainder
// 18 divided by 7 is 2 remainder 4 (or 2.571...)
// so the quotient of 18 and 7 is 2
xit('returns the quotient from dividing the first number by the second number', () => {
it('returns the quotient from dividing the first number by the second number', () => {
expect(quotient(10, 3)).toEqual(3);
expect(quotient(18, 7)).toEqual(2);
expect(quotient(77, 10)).toEqual(7);
Expand All @@ -102,7 +102,7 @@ describe('quotient', () => {
});

describe('remainder', () => {
xit('returns the remainder when dividing the first number by the second number', () => {
it('returns the remainder when dividing the first number by the second number', () => {
expect(remainder(10, 3)).toEqual(1);
expect(remainder(18, 7)).toEqual(4);
expect(remainder(77, 10)).toEqual(7);
Expand Down
18 changes: 9 additions & 9 deletions src/__tests__/objects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const {
} = require('../objects');

describe('createPerson', () => {
xit('creates an object with the given name and age properties', () => {
it('creates an object with the given name and age properties', () => {
expect(createPerson('Fred', 79)).toEqual({
name: 'Fred',
age: 79
Expand All @@ -26,7 +26,7 @@ describe('createPerson', () => {
});

describe('getName', () => {
xit('returns the name property of the object', () => {
it('returns the name property of the object', () => {
expect(
getName({
name: 'Fred',
Expand All @@ -43,7 +43,7 @@ describe('getName', () => {
});

describe('getProperty', () => {
xit('returns the given property', () => {
it('returns the given property', () => {
expect(
getProperty('age', {
name: 'Fred',
Expand All @@ -70,7 +70,7 @@ describe('hasProperty', () => {
age: 23
};

xit('returns true if the object has the given property', () => {
it('returns true if the object has the given property', () => {
expect(hasProperty('age', fred)).toBe(true);
expect(hasProperty('name', tom)).toBe(true);
expect(hasProperty('favouriteColour', fred)).toBe(false);
Expand All @@ -79,7 +79,7 @@ describe('hasProperty', () => {
});

describe('isOver65', () => {
xit('returns true if the person is aged over 65', () => {
it('returns true if the person is aged over 65', () => {
const jim = {
name: 'Jim',
age: 66
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('getAges', () => {
});

describe('findByName', () => {
xit('returns the person with the given name', () => {
it('returns the person with the given name', () => {
const jim = {
name: 'Jim',
age: 66
Expand All @@ -147,7 +147,7 @@ describe('findByName', () => {
});

describe('findHondas', () => {
xit('returns a list of cars manufactured by Honda', () => {
it('returns a list of cars manufactured by Honda', () => {
const car1 = {
manufacturer: 'Honda',
year: 1997,
Expand Down Expand Up @@ -179,7 +179,7 @@ describe('findHondas', () => {
});

describe('averageAge', () => {
xit('returns the average age of the people in the list', () => {
it('returns the average age of the people in the list', () => {
const john = {
name: 'John',
age: 60
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('averageAge', () => {
});

describe('createTalkingPerson', () => {
xit('returns a person who can introduce themselves', () => {
it('returns a person who can introduce themselves', () => {
const bill = createTalkingPerson('Bill', 40);
const catherine = createTalkingPerson('Catherine', 21);
expect(bill).toEqual({
Expand Down
18 changes: 9 additions & 9 deletions src/__tests__/strings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,57 @@ const {
} = require('../strings');

describe('sayHello', () => {
xit('returns "Hello world!" when passed "world"', () => {
it('returns "Hello world!" when passed "world"', () => {
expect(sayHello('world')).toEqual('Hello, world!');
});

xit('returns "Hello MCR Codes!" when passed "MCR Codes"', () => {
it('returns "Hello MCR Codes!" when passed "MCR Codes"', () => {
expect(sayHello('MCR Codes')).toEqual('Hello, MCR Codes!');
});

xit('returns "Hello fsghjdfkhgf!" when passed "fsghjdfkhgf"', () => {
it('returns "Hello fsghjdfkhgf!" when passed "fsghjdfkhgf"', () => {
expect(sayHello('fsghjdfkhgf')).toEqual('Hello, fsghjdfkhgf!');
});
});

describe('uppercase', () => {
xit('returns the uppercased string', () => {
it('returns the uppercased string', () => {
expect(uppercase('abc')).toEqual('ABC');
expect(uppercase('def')).toEqual('DEF');
expect(uppercase('ghi')).toEqual('GHI');
});
});

describe('lowercase', () => {
xit('returns the lowercased string', () => {
it('returns the lowercased string', () => {
expect(lowercase('ABC')).toEqual('abc');
expect(lowercase('DEF')).toEqual('def');
expect(lowercase('GHI')).toEqual('ghi');
});
});

describe('countCharacters', () => {
xit('returns the number of characters in the string', () => {
it('returns the number of characters in the string', () => {
expect(countCharacters('fsfsgsfdg')).toEqual(9);
expect(countCharacters('fsfsg')).toEqual(5);
expect(countCharacters('')).toEqual(0);
});
});

describe('firstCharacter', () => {
xit('returns the first character of the string', () => {
it('returns the first character of the string', () => {
expect(firstCharacter('ABC')).toEqual('A');
expect(firstCharacter('DEF')).toEqual('D');
expect(firstCharacter('GHI')).toEqual('G');
});
});

describe('firstCharacters', () => {
xit('returns the first 4 characters of the string', () => {
it('returns the first 4 characters of the string', () => {
expect(firstCharacters('sd32fg45', 4)).toEqual('sd32');
});

xit('returns the first 2 characters of the string', () => {
it('returns the first 2 characters of the string', () => {
expect(firstCharacters('asd', 2)).toEqual('as');
});
});
2 changes: 1 addition & 1 deletion src/arrays.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const getNthElement = (index, array) => {
// your code here
console.log ([index] array);
};

const arrayToCSVString = array => {
Expand Down
Loading