Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bed2c08
typed in the number text
AJlobb Feb 28, 2022
761d2ca
Tests passed. Adding X infront of it
AJlobb Feb 28, 2022
f298ef3
strings completed
WhyAtS Feb 28, 2022
d2b2abd
first three passes on Objects
AJlobb Feb 28, 2022
91c5bb6
test for over 65 working
AJlobb Feb 28, 2022
3ceecdf
test passed for ages
AJlobb Feb 28, 2022
0f56e59
Classes JS complete
Redtigercod4 Feb 28, 2022
0e28981
Strings JS complete
Redtigercod4 Feb 28, 2022
d68a8ff
passed the find by name test
AJlobb Feb 28, 2022
bdaddc9
test average age and HONDA passes
AJlobb Feb 28, 2022
2581e34
Booleans & numbers completed
Redtigercod4 Feb 28, 2022
ff07b71
ArraysUpdate
HWSolo Feb 28, 2022
f9ce2c1
Finished createTalkingPerson
AJlobb Feb 28, 2022
62d7fac
arrays work
Redtigercod4 Feb 28, 2022
f6c62f8
Revert "Strings JS complete"
Redtigercod4 Feb 28, 2022
44df0a4
Revert "Booleans & numbers completed"
Redtigercod4 Feb 28, 2022
dc47df7
Revert "arrays work"
Redtigercod4 Feb 28, 2022
08652ca
Update booleans.js
mini1998 Feb 28, 2022
f24986b
Update booleans.test.js
mini1998 Feb 28, 2022
7f9b021
Merge pull request #3 from MichealWilkinson-MT/Han/Tom
Papgooner Feb 28, 2022
113529b
Merge pull request #1 from MichealWilkinson-MT/JS
MichealWilkinson-MT Feb 28, 2022
1958347
Merge pull request #6 from MichealWilkinson-MT/arrays
MichealWilkinson-MT Feb 28, 2022
2a29b9c
Merge pull request #5 from MichealWilkinson-MT/Nath/Kieron-Boo
MichealWilkinson-MT Feb 28, 2022
8834afd
Merge pull request #4 from MichealWilkinson-MT/wes/cal
MichealWilkinson-MT Feb 28, 2022
1a832e5
Merge pull request #2 from MichealWilkinson-MT/AJ/Mark
MichealWilkinson-MT Feb 28, 2022
7e56850
Giving credit to MCRCodes
MichealWilkinson-MT Feb 28, 2022
eebdd37
Merge pull request #7 from MichealWilkinson-MT/arrays
MichealWilkinson-MT Feb 28, 2022
d07c355
created code for removeSpaces and passes test
AJlobb Mar 1, 2022
52fa716
created code and tested for onlyEven
AJlobb Mar 1, 2022
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# JavaScript Basics
This was lovingly coppied from [MCRcodes/javascript-basics](https://github.com/MCRcodes/javascript-basics) but modified for use in our 2022 bootcamp. All credit goes to [MCRCodes](https://github.com/MCRcodes) for the amazing work in this repo

The repository contains test cases and empty function definitions which need to be populated to solve the different challenges set in this weeks walkthrough. 🚨*You should not update the tests!* 🚨

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/arrays.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('reverseWordsInArray', () => {
});

describe('onlyEven', () => {
xit('filters the array and only returns even numbers', () => {
it('filters the array and only returns even numbers', () => {
expect(onlyEven([1, 2, 3, 4, 5, 6, 7, 8])).toEqual([2, 4, 6, 8]);
expect(onlyEven([8, 9, 10, 11, 12, 13, 14, 15])).toEqual([8, 10, 12, 14]);
});
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,14 +17,14 @@ 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);
Expand All @@ -33,7 +33,7 @@ describe('both', () => {
});

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 @@ -60,7 +60,7 @@ describe('one', () => {
});

describe('truthiness', () => {
xit('returns the truthiness of the given value', () => {
it('returns the truthiness of the given value', () => {
expect(truthiness('')).toBe(false);
expect(truthiness('dbbd')).toBe(true);
expect(truthiness(0)).toBe(false);
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
18 changes: 9 additions & 9 deletions src/__tests__/class.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ const {
} = require('../class');

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

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

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

describe('uppercase', () => {
xit('returns the uppercased string', () => {
it('returns the uppercased string', () => {
const obj1 = new testingClass('abc');
expect(obj1.uppercase()).toEqual('ABC');
const obj2 = new testingClass('def');
Expand All @@ -31,7 +31,7 @@ describe('uppercase', () => {
});

describe('lowercase', () => {
xit('returns the lowercased string', () => {
it('returns the lowercased string', () => {
const obj1 = new testingClass('ABC');
expect(obj1.lowercase()).toEqual('abc');
const obj2 = new testingClass('dEf');
Expand All @@ -42,7 +42,7 @@ describe('lowercase', () => {
});

describe('countCharacters', () => {
xit('returns the number of characters in the string', () => {
it('returns the number of characters in the string', () => {
const obj1 = new testingClass('fsfsgsfdg');
const obj2 = new testingClass('fsfsg');
const obj3 = new testingClass('');
Expand All @@ -54,7 +54,7 @@ describe('countCharacters', () => {
});

describe('firstCharacter', () => {
xit('returns the first character of the string', () => {
it('returns the first character of the string', () => {
const obj1 = new testingClass('ABC');
const obj2 = new testingClass('dEf');
const obj3 = new testingClass('GHi');
Expand All @@ -65,13 +65,13 @@ describe('firstCharacter', () => {
});

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

xit('returns the first 2 characters of the string', () => {
it('returns the first 2 characters of the string', () => {
const obj1 = new testingClass('asd');
expect(obj1.firstCharacters(2)).toEqual('as');
});
Expand Down
20 changes: 10 additions & 10 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 All @@ -102,7 +102,7 @@ describe('isOver65', () => {
});

describe('getAges', () => {
xit('returns the ages of each person in the array', () => {
it('returns the ages of each person in the array', () => {
const jim = {
name: 'Jim',
age: 66
Expand All @@ -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');
});
});
Loading