Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
414e578
passed assignment.js test
sigristarisa Mar 3, 2022
b40610c
passed the test of declaration.js
sigristarisa Mar 3, 2022
251283a
passed the test of example.js
sigristarisa Mar 3, 2022
b95d53b
passed the test for boolean-conditions.js
sigristarisa Mar 3, 2022
71488be
passed the test for multiple-conditions.js
sigristarisa Mar 3, 2022
df2465a
passed the test for numeric-conditions.js
sigristarisa Mar 3, 2022
e6c41ce
passed the test of string-conditions.js
sigristarisa Mar 3, 2022
9032d87
passed the test of numbers.js
sigristarisa Mar 3, 2022
87c1f1c
passed the test for strings.js
sigristarisa Mar 3, 2022
4971da3
passed the test for accessing-elements.spec.js
sigristarisa Mar 3, 2022
e71d808
passed the test for adding-removing-elements.js
sigristarisa Mar 3, 2022
3e01ee4
passed the test for creating-objects.js
sigristarisa Mar 3, 2022
7a092ae
passed the test for object-keys.js
sigristarisa Mar 3, 2022
7c5c466
passed the test for objects-and-arrays.spec.js
sigristarisa Mar 3, 2022
d507190
passed the test for calling-functions.spec.js
sigristarisa Mar 3, 2022
cc95b4c
passed the test for creating-functions-multiple-args.js
sigristarisa Mar 3, 2022
ecbb8b3
passed the test for creating-functions.js
sigristarisa Mar 3, 2022
afc511d
passed the test for for-loop-basic.spec.js
sigristarisa Mar 3, 2022
9199a79
passed the test for for-loops-and-array.spec.js
sigristarisa Mar 3, 2022
708ef54
updated the test for objects-and-arrays.spec.js
sigristarisa Mar 3, 2022
6ab2f2d
updated the test for adding-removing-elements.spec.js
sigristarisa Mar 3, 2022
017f703
added the correct answer for numeric-conditions.js
sigristarisa Mar 8, 2022
d2e88e9
has the correct answer for numeric-conditions.js
sigristarisa Mar 8, 2022
ee18a25
added the correct answer for demo.js
sigristarisa Mar 8, 2022
b850559
removed commenting out and refactored onject-keys.js
sigristarisa Mar 9, 2022
6010056
refactored objects-and-arrays.js
sigristarisa Mar 9, 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 package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/conditional-flow/boolean-conditions.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { a } = require('../../src/conditional-flow/boolean-conditions')

describe("Boolean conditions getResult:", () => {
describe('Boolean conditions getResult:', () => {
it("Returns 'Well done, you passed!' with true", () => {
expect(a(true)).toEqual('Well done, you passed!')
})
Expand Down
8 changes: 4 additions & 4 deletions spec/conditional-flow/example.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const example = require('../../src/conditional-flow/example.js')

describe("example", () => {
it("19 returns true", () => {
describe('example', () => {
it('19 returns true', () => {
expect(example(19)).toEqual(true)
})
it("18 returns true", () => {
it('18 returns true', () => {
expect(example(18)).toEqual(true)
})
it("17 returns false", () => {
it('17 returns false', () => {
expect(example(17)).toEqual(false)
})
})
72 changes: 35 additions & 37 deletions spec/conditional-flow/multiple-conditions.spec.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
const {a, b, c} = require('../../src/conditional-flow/multiple-conditions')
const { a, b, c } = require('../../src/conditional-flow/multiple-conditions')

describe("Multiple Conditions isInRange:", () => {
it("4 is between 1 and 6", () => {
describe('Multiple Conditions isInRange:', () => {
it('4 is between 1 and 6', () => {
expect(a(4, 1, 6)).toEqual(true)
})
it("10 is not between 1 and 5", () => {
it('10 is not between 1 and 5', () => {
expect(a(10, 1, 5)).toEqual(false)
})
it("10 is between 1 and 10", () => {
it('10 is between 1 and 10', () => {
expect(a(10, 1, 10)).toEqual(true)
})
it("8 is between 8 and 8", () => {
it('8 is between 8 and 8', () => {
expect(a(8, 8, 8)).toEqual(true)
})
})

describe("Multiple Conditions isHelloOrGoodbye:", () => {
describe('Multiple Conditions isHelloOrGoodbye:', () => {
it("'Hello' returns true", () => {
expect(b('Hello')).toEqual(true)
})
Expand All @@ -28,39 +28,37 @@ describe("Multiple Conditions isHelloOrGoodbye:", () => {
expect(b('Goodbye')).toEqual(true)
})
})

describe("Multiple Conditions getAgeDescription:", () => {
it("0 is a Baby", () => {
expect(c(0)).toEqual("Baby")
describe('Multiple Conditions getAgeDescription:', () => {
it('0 is a Baby', () => {
expect(c(0)).toEqual('Baby')
})
it("1-4 is a Toddler", () => {
expect(c(1)).toEqual("Toddler")
expect(c(2)).toEqual("Toddler")
expect(c(3)).toEqual("Toddler")
expect(c(4)).toEqual("Toddler")
it('1-4 is a Toddler', () => {
expect(c(1)).toEqual('Toddler')
expect(c(2)).toEqual('Toddler')
expect(c(3)).toEqual('Toddler')
expect(c(4)).toEqual('Toddler')
})
it("5-12 is a Child", () => {
expect(c(5)).toEqual("Child")
expect(c(6)).toEqual("Child")
expect(c(7)).toEqual("Child")
expect(c(9)).toEqual("Child")
expect(c(10)).toEqual("Child")
expect(c(11)).toEqual("Child")
expect(c(12)).toEqual("Child")
it('5-12 is a Child', () => {
expect(c(5)).toEqual('Child')
expect(c(6)).toEqual('Child')
expect(c(7)).toEqual('Child')
expect(c(9)).toEqual('Child')
expect(c(10)).toEqual('Child')
expect(c(11)).toEqual('Child')
expect(c(12)).toEqual('Child')
})
it("13-19 is a Teenager", () => {
expect(c(13)).toEqual("Teenager")
expect(c(14)).toEqual("Teenager")
expect(c(15)).toEqual("Teenager")
expect(c(16)).toEqual("Teenager")
expect(c(17)).toEqual("Teenager")
expect(c(18)).toEqual("Teenager")
expect(c(19)).toEqual("Teenager")
it('13-19 is a Teenager', () => {
expect(c(13)).toEqual('Teenager')
expect(c(14)).toEqual('Teenager')
expect(c(15)).toEqual('Teenager')
expect(c(16)).toEqual('Teenager')
expect(c(17)).toEqual('Teenager')
expect(c(18)).toEqual('Teenager')
expect(c(19)).toEqual('Teenager')
})
it("20+ is an Adult", () => {
expect(c(20)).toEqual("Adult")
expect(c(25)).toEqual("Adult")
expect(c(40)).toEqual("Adult")
it('20+ is an Adult', () => {
expect(c(20)).toEqual('Adult')
expect(c(25)).toEqual('Adult')
expect(c(40)).toEqual('Adult')
})

})
28 changes: 14 additions & 14 deletions spec/conditional-flow/numeric-conditions.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const {a, b, c} = require('../../src/conditional-flow/numeric-conditions')
const { a, b, c } = require('../../src/conditional-flow/numeric-conditions.js')

describe("Numeric Conditions isArrayEmpty:", () => {
it("[] is empty", () => {
describe('Numeric Conditions isArrayEmpty:', () => {
it('[] is empty', () => {
expect(a([])).toEqual(true)
})
it("[1] is not empty", () => {
it('[1] is not empty', () => {
expect(a([1])).toEqual(false)
})

Expand All @@ -13,34 +13,34 @@ describe("Numeric Conditions isArrayEmpty:", () => {
})
})

describe("Numeric conditions isGreaterThan:", () => {
it("3 is greater than 2", () => {
describe('Numeric conditions isGreaterThan:', () => {
it('3 is greater than 2', () => {
expect(b(3, 2)).toEqual(true)
})

it("0 is not greater than 10", () => {
it('0 is not greater than 10', () => {
expect(b(0, 10)).toEqual(false)
})

it("42 is not greater than 42", () => {
it('42 is not greater than 42', () => {
expect(b(42, 42)).toEqual(false)
})

it("-1 is greater than -3", () => {
it('-1 is greater than -3', () => {
expect(b(-1, -3)).toEqual(true)
})
})

describe("Numeric Conditions findLowest:", () => {
it("1 is lowest in [10, 8, 4, 1, 8]", () => {
describe('Numeric Conditions findLowest:', () => {
it('1 is lowest in [10, 8, 4, 1, 8]', () => {
expect(c([10, 8, 4, 1, 8])).toEqual(1)
})

it("-10 is lowest in [0, 0, -10]", () => {
it('-10 is lowest in [0, 0, -10]', () => {
expect(c([0, 0, -10])).toEqual(-10)
})

it("100 is lowest in [100,100,100,100]", () => {
it('100 is lowest in [100,100,100,100]', () => {
expect(c([100, 100, 100])).toEqual(100)
})
})
})
41 changes: 20 additions & 21 deletions spec/conditional-flow/string-conditions.spec.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
const { a, b, c, d, e, f } = require('../../src/conditional-flow/string-conditions')

describe("String Conditions isHello:", () => {
describe('String Conditions isHello:', () => {
it("Returns false with 'goodbye'", () => {
expect(a("goodbye")).toEqual(false)
expect(a('goodbye')).toEqual(false)
})
it("Returns true with 'Hello'", () => {
expect(a("Hello")).toEqual(true)
expect(a('Hello')).toEqual(true)
})
})

describe("String Conditions isNotHello:", () => {
describe('String Conditions isNotHello:', () => {
it("Returns true with 'goodbye'", () => {
expect(b("goodbye")).toEqual(true)
expect(b('goodbye')).toEqual(true)
})
it("Returns false with 'Hello'", () => {
expect(b("Hello")).toEqual(false)
expect(b('Hello')).toEqual(false)
})
})

describe("String Conditions isLongerThan:", () => {
describe('String Conditions isLongerThan:', () => {
it("'Mike' is longer than 'Ed'", () => {
expect(c("Mike", "Ed")).toEqual(true)
expect(c('Mike', 'Ed')).toEqual(true)
})
it("'Mike' is not longer than 'Lewis'", () => {
expect(c("Mike", "Lewis")).toEqual(false)
expect(c('Mike', 'Lewis')).toEqual(false)
})
it("'Mike' is not longer than 'Mike'", () => {
expect(c("Mike", "Mike")).toEqual(false)
expect(c('Mike', 'Mike')).toEqual(false)
})
})

describe("String Conditions hasOddNumberVowels:", () => {
describe('String Conditions hasOddNumberVowels:', () => {
it("'Alex' does not have odd number vowels", () => {
expect(d("Alex")).toEqual(false)
expect(d('Alex')).toEqual(false)
})
it("'Mo' does have odd number vowels", () => {
expect(d("Mo")).toEqual(true)
expect(d('Mo')).toEqual(true)
})
it("'Joanna' does have odd number vowels", () => {
expect(d("Joanna")).toEqual(true)
expect(d('Joanna')).toEqual(true)
})
it("'Maggie Smith' does not have odd number vowels", () => {
expect(d("Maggie Smith")).toEqual(false)
expect(d('Maggie Smith')).toEqual(false)
})
})

describe("String conditions getMiddleLetter:", () => {
describe('String conditions getMiddleLetter:', () => {
it("'Alex' returns 'le'", () => {
expect(e("Alex")).toEqual('le')
expect(e('Alex')).toEqual('le')
})
it("'Edward' returns 'wa'", () => {
expect(e("Edward")).toEqual('wa')
expect(e('Edward')).toEqual('wa')
})
it("'Kayla' returns 'y'", () => {
expect(e("Kayla")).toEqual('y')
expect(e('Kayla')).toEqual('y')
})
it("'Tom' returns 'o'", () => {
expect(e("Tom")).toEqual('o')
expect(e('Tom')).toEqual('o')
})
})

Expand Down Expand Up @@ -101,4 +101,3 @@ describe('String conditions seasonForMonth:', () => {
expect(f('Marchprilvember')).toEqual('')
})
})

17 changes: 8 additions & 9 deletions spec/data-types/arrays/accessing-elements.spec.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
const answers = require('../../../src/data-types/arrays/accessing-elements.js')

describe("Arrays accessing:", () => {
it("names equals Bob, Jane, Joanna", () => {
expect(answers.a).toEqual(["Bob", "Jane", "Joanna"])
describe('Arrays accessing:', () => {
it('names equals Bob, Jane, Joanna', () => {
expect(answers.a).toEqual(['Bob', 'Jane', 'Joanna'])
})

it("fourthCity is Delhi", () => {
expect(answers.b).toEqual("Delhi")
it('fourthCity is Delhi', () => {
expect(answers.b).toEqual('Delhi')
})

it("firstCity is London", () => {
expect(answers.c).toEqual("London")
it('firstCity is London', () => {
expect(answers.c).toEqual('London')
})

it("lengthOfCitiesArray is 5", () => {
it('lengthOfCitiesArray is 5', () => {
expect(answers.d).toEqual(5)
})

})
32 changes: 16 additions & 16 deletions spec/data-types/arrays/adding-removing-elements.spec.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
const answers = require('../../../src/data-types/arrays/adding-removing-elements.js')

describe("Arrays adding and removing:", () => {
describe('Arrays adding and removing:', () => {
it("names contains a single element 'Fred'", () => {
expect(answers.a).toEqual(["Fred"])
expect(answers.a).toEqual(['Fred'])
})

it("numbers is 1,2,3,4", () => {
expect(answers.b).toEqual([1,2,3,4])
it('numbers is 1,2,3,4', () => {
expect(answers.b).toEqual([1, 2, 3, 4])
})

it("Rio is added to the start of cities", () => {
expect(answers.c).toEqual(["Rio", "London", "Shanghai", "New York", "Delhi", "Kuala Lumpur"])
it('Rio is added to the start of cities', () => {
expect(answers.c).toEqual(['Rio', 'London', 'Shanghai', 'New York', 'Delhi', 'Kuala Lumpur'])
})

it("Red is removed from the start of colours", () => {
expect(answers.d).toEqual(["Blue", "Yellow"])
it('Red is removed from the start of colours', () => {
expect(answers.d).toEqual(['Blue', 'Yellow'])
})

it("Y is removed from the keys array", () => {
expect(answers.e).toEqual(["q", "w", "e", "r", "t"])
it('Y is removed from the keys array', () => {
expect(answers.e).toEqual(['q', 'w', 'e', 'r', 't'])
})

it("Jordan is removed from the countries array", () => {
expect(answers.f).toEqual(["Bolivia", "Greenland"])
it('Jordan is removed from the countries array', () => {
expect(answers.f).toEqual(['Bolivia', 'Greenland'])
})

it("Pear is removed from fruits", () => {
expect(answers.g).toEqual(["Apple", "Orange"])
it('Pear is removed from fruits', () => {
expect(answers.g).toEqual(['Apple', 'Orange'])
})

it("The removed item from fruits is stored in the pear variable", () => {
expect(answers.h).toEqual("Pear")
it('The removed item from fruits is stored in the pear variable', () => {
expect(answers.h).toEqual('Pear')
})
})
14 changes: 7 additions & 7 deletions spec/data-types/numbers.spec.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
const { a, b, c, d, e, f } = require('../../src/data-types/numbers')

describe("Numbers:", () => {
it("numOnePlusNumTwo is 24", () => {
describe('Numbers:', () => {
it('numOnePlusNumTwo is 24', () => {
expect(a).toEqual(24)
})

it("numThreeTimesNumTwo is 512", () => {
it('numThreeTimesNumTwo is 512', () => {
expect(b).toEqual(512)
})

it("numThreeDividedByNumOne is 4", () => {
it('numThreeDividedByNumOne is 4', () => {
expect(c).toEqual(4)
})

it("numThreeMinusNumOne is 24", () => {
it('numThreeMinusNumOne is 24', () => {
expect(d).toEqual(24)
})

it("sum is 56", () => {
it('sum is 56', () => {
expect(e).toEqual(56)
})

it("numBytes is 7", () => {
it('numBytes is 7', () => {
expect(f).toEqual(7)
})
})
Loading