trackler 2.1.0.16 → 2.1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/fixtures/tracks/snowflake/exercises/snowflake-only/{description.md → .meta/description.md} +0 -0
- data/fixtures/tracks/snowflake/exercises/snowflake-only/{metadata.yml → .meta/metadata.yml} +0 -0
- data/lib/trackler/guaranteed_file.rb +2 -2
- data/lib/trackler/version.rb +1 -1
- data/tracks/coq/exercises/tautology/{description.md → .meta/description.md} +0 -0
- data/tracks/coq/exercises/tautology/{metadata.yml → .meta/metadata.yml} +0 -0
- data/tracks/java/exercises/robot-simulator/src/test/java/RobotTest.java +1 -1
- data/tracks/perl6/config.json +1 -1
- data/tracks/ruby/exercises/phone-number/.meta/.version +1 -1
- data/tracks/ruby/exercises/phone-number/.meta/solutions/phone_number.rb +1 -1
- data/tracks/ruby/exercises/phone-number/phone_number_test.rb +2 -7
- data/tracks/ruby/exercises/space-age/.meta/.version +1 -0
- data/tracks/ruby/exercises/space-age/.meta/generator/space_age_case.rb +11 -0
- data/tracks/ruby/exercises/space-age/.meta/generator/test_template.erb +25 -0
- data/tracks/ruby/exercises/space-age/.meta/solutions/space_age.rb +4 -0
- data/tracks/ruby/exercises/space-age/space_age_test.rb +30 -16
- data/tracks/ruby/lib/generator/underscore.rb +6 -0
- data/tracks/rust/config.json +0 -1
- data/tracks/typescript/exercises/anagram/anagram.test.ts +10 -10
- data/tracks/typescript/exercises/beer-song/beer-song.test.ts +5 -5
- data/tracks/typescript/exercises/bob/bob.test.ts +16 -16
- data/tracks/typescript/exercises/etl/etl.test.ts +3 -3
- data/tracks/typescript/exercises/food-chain/food-chain.test.ts +9 -9
- data/tracks/typescript/exercises/gigasecond/gigasecond.test.ts +3 -3
- data/tracks/typescript/exercises/grade-school/grade-school.test.ts +8 -8
- data/tracks/typescript/exercises/hamming/hamming.test.ts +7 -7
- data/tracks/typescript/exercises/hello-world/hello-world.test.ts +2 -2
- data/tracks/typescript/exercises/leap/leap.test.ts +7 -7
- data/tracks/typescript/exercises/pangram/pangram.test.ts +8 -8
- data/tracks/typescript/exercises/phone-number/phone-number.test.ts +9 -9
- data/tracks/typescript/exercises/rna-transcription/rna-transcription.test.ts +7 -7
- data/tracks/typescript/exercises/robot-name/robot-name.test.ts +7 -7
- data/tracks/typescript/exercises/say/say.test.ts +15 -15
- data/tracks/typescript/exercises/space-age/space-age.test.ts +8 -8
- data/tracks/typescript/exercises/word-count/word-count.test.ts +11 -11
- data/tracks/typescript/exercises/wordy/wordy.test.ts +15 -15
- metadata +8 -11
- data/tracks/coq/exercises/hello-world/metadata.yml +0 -3
- data/tracks/coq/exercises/rna-transcription/metadata.yml +0 -3
- data/tracks/rust/exercises/luhn-from/description.md +0 -9
- data/tracks/rust/exercises/luhn-from/metadata.yml +0 -3
- data/tracks/rust/exercises/luhn-trait/description.md +0 -17
- data/tracks/rust/exercises/luhn-trait/metadata.yml +0 -3
@@ -11,14 +11,14 @@ describe('School', () => {
|
|
11
11
|
expect(gradeSchool.studentRoster().size === 0).toEqual(true)
|
12
12
|
})
|
13
13
|
|
14
|
-
|
14
|
+
xit('adding a student adds them to the roster for the given grade', () => {
|
15
15
|
gradeSchool.addStudent('Aimee', 2)
|
16
16
|
|
17
17
|
const expectedDb = new Map(Object.entries({ 2 : [ 'Aimee' ] }))
|
18
18
|
expect(gradeSchool.studentRoster()).toEqual(expectedDb)
|
19
19
|
})
|
20
20
|
|
21
|
-
|
21
|
+
xit('adding more students to the same grade adds them to the roster', () => {
|
22
22
|
gradeSchool.addStudent('Blair', 2)
|
23
23
|
gradeSchool.addStudent('James', 2)
|
24
24
|
gradeSchool.addStudent('Paul', 2)
|
@@ -27,7 +27,7 @@ describe('School', () => {
|
|
27
27
|
expect(gradeSchool.studentRoster()).toEqual(expectedDb)
|
28
28
|
})
|
29
29
|
|
30
|
-
|
30
|
+
xit('adding students to different grades adds them to the roster', () => {
|
31
31
|
gradeSchool.addStudent('Chelsea', 3)
|
32
32
|
gradeSchool.addStudent('Logan', 7)
|
33
33
|
|
@@ -35,7 +35,7 @@ describe('School', () => {
|
|
35
35
|
expect(gradeSchool.studentRoster()).toEqual(expectedDb)
|
36
36
|
})
|
37
37
|
|
38
|
-
|
38
|
+
xit('grade returns the students in that grade in alphabetical order', () => {
|
39
39
|
gradeSchool.addStudent('Franklin', 5)
|
40
40
|
gradeSchool.addStudent('Bradley', 5)
|
41
41
|
gradeSchool.addStudent('Jeff', 1)
|
@@ -44,11 +44,11 @@ describe('School', () => {
|
|
44
44
|
expect(gradeSchool.studentsInGrade(5)).toEqual(expectedStudents)
|
45
45
|
})
|
46
46
|
|
47
|
-
|
47
|
+
xit('grade returns an empty array if there are no students in that grade', () => {
|
48
48
|
expect(gradeSchool.studentsInGrade(1)).toEqual([])
|
49
49
|
})
|
50
50
|
|
51
|
-
|
51
|
+
xit('the students names in each grade in the roster are sorted', () => {
|
52
52
|
gradeSchool.addStudent('Jennifer', 4)
|
53
53
|
gradeSchool.addStudent('Kareem', 6)
|
54
54
|
gradeSchool.addStudent('Christopher', 4)
|
@@ -62,7 +62,7 @@ describe('School', () => {
|
|
62
62
|
expect(gradeSchool.studentRoster()).toEqual(expectedSortedStudents)
|
63
63
|
})
|
64
64
|
|
65
|
-
|
65
|
+
xit('roster cannot be modified outside of module', () => {
|
66
66
|
gradeSchool.addStudent('Aimee', 2)
|
67
67
|
const roster = gradeSchool.studentRoster()
|
68
68
|
const result = roster.get('2') || []
|
@@ -71,7 +71,7 @@ describe('School', () => {
|
|
71
71
|
expect(gradeSchool.studentRoster()).toEqual(expectedDb)
|
72
72
|
})
|
73
73
|
|
74
|
-
|
74
|
+
xit('roster cannot be modified outside of module using studentsInGrade()', () => {
|
75
75
|
gradeSchool.addStudent('Aimee', 2)
|
76
76
|
gradeSchool.studentsInGrade(2).push('Oops.')
|
77
77
|
const expectedDb = new Map(Object.entries({ 2 : [ 'Aimee' ] }))
|
@@ -7,31 +7,31 @@ describe('Hamming', () => {
|
|
7
7
|
expect(hamming.compute('A', 'A')).toEqual(0)
|
8
8
|
})
|
9
9
|
|
10
|
-
|
10
|
+
xit('complete hamming distance for single nucleotide strand', () => {
|
11
11
|
expect(hamming.compute('A', 'G')).toEqual(1)
|
12
12
|
})
|
13
13
|
|
14
|
-
|
14
|
+
xit('complete hamming distance for small strand', () => {
|
15
15
|
expect(hamming.compute('AG', 'CT')).toEqual(2)
|
16
16
|
})
|
17
17
|
|
18
|
-
|
18
|
+
xit('small hamming distance', () => {
|
19
19
|
expect(hamming.compute('AT', 'CT')).toEqual(1)
|
20
20
|
})
|
21
21
|
|
22
|
-
|
22
|
+
xit('small hamming distance in longer strand', () => {
|
23
23
|
expect(hamming.compute('GGACG', 'GGTCG')).toEqual(1)
|
24
24
|
})
|
25
25
|
|
26
|
-
|
26
|
+
xit('large hamming distance', () => {
|
27
27
|
expect(hamming.compute('GATACA', 'GCATAA')).toEqual(4)
|
28
28
|
})
|
29
29
|
|
30
|
-
|
30
|
+
xit('hamming distance in very long strand', () => {
|
31
31
|
expect(hamming.compute('GGACGGATTCTG', 'AGGACGGATTCT')).toEqual(9)
|
32
32
|
})
|
33
33
|
|
34
|
-
|
34
|
+
xit('throws error when strands are not equal length', () => {
|
35
35
|
expect(() => { hamming.compute('GGACGGATTCTG', 'AGGAC') }
|
36
36
|
).toThrowError('DNA strands must be of equal length.' )
|
37
37
|
})
|
@@ -7,11 +7,11 @@ describe('Hello World', () => {
|
|
7
7
|
expect(HelloWorld.hello()).toEqual('Hello, World!')
|
8
8
|
})
|
9
9
|
|
10
|
-
|
10
|
+
xit('says hello to bob', () => {
|
11
11
|
expect(HelloWorld.hello('Bob')).toEqual('Hello, Bob!')
|
12
12
|
})
|
13
13
|
|
14
|
-
|
14
|
+
xit('says hello to sally', () => {
|
15
15
|
expect(HelloWorld.hello('Sally')).toEqual('Hello, Sally!')
|
16
16
|
})
|
17
17
|
})
|
@@ -6,33 +6,33 @@ describe('A leap year', () => {
|
|
6
6
|
expect(isLeapYear(2015)).toBeFalsy()
|
7
7
|
})
|
8
8
|
|
9
|
-
|
9
|
+
xit('is introduced every 4 years to adjust about a day', () => {
|
10
10
|
expect(isLeapYear(2016)).toBeTruthy()
|
11
11
|
})
|
12
12
|
|
13
|
-
|
13
|
+
xit('is skipped every 100 years to remove an extra day', () => {
|
14
14
|
expect(isLeapYear(1900)).toBeFalsy()
|
15
15
|
})
|
16
16
|
|
17
|
-
|
17
|
+
xit('is reintroduced every 400 years to adjust another day', () => {
|
18
18
|
expect(isLeapYear(2000)).toBeTruthy()
|
19
19
|
})
|
20
20
|
|
21
21
|
describe('Additional example of a leap year that', () => {
|
22
22
|
|
23
|
-
|
23
|
+
xit('is not a leap year', () => {
|
24
24
|
expect(isLeapYear(1978)).toBeFalsy()
|
25
25
|
})
|
26
26
|
|
27
|
-
|
27
|
+
xit('is a common leap year', () => {
|
28
28
|
expect(isLeapYear(1992)).toBeTruthy()
|
29
29
|
})
|
30
30
|
|
31
|
-
|
31
|
+
xit('is skipped every 100 years', () => {
|
32
32
|
expect(isLeapYear(2100)).toBeFalsy()
|
33
33
|
})
|
34
34
|
|
35
|
-
|
35
|
+
xit('is reintroduced every 400 years', () => {
|
36
36
|
expect(isLeapYear(2400)).toBeTruthy()
|
37
37
|
})
|
38
38
|
})
|
@@ -7,42 +7,42 @@ describe('Pangram()', () => {
|
|
7
7
|
expect(pangram.isPangram()).toBe(false)
|
8
8
|
})
|
9
9
|
|
10
|
-
|
10
|
+
xit('pangram with only lower case', () => {
|
11
11
|
const pangram = new Pangram("the quick brown fox jumps over the lazy dog")
|
12
12
|
expect(pangram.isPangram()).toBe(true)
|
13
13
|
})
|
14
14
|
|
15
|
-
|
15
|
+
xit("missing character 'x'", () => {
|
16
16
|
const pangram = new Pangram("a quick movement of the enemy will jeopardize five gunboats")
|
17
17
|
expect(pangram.isPangram()).toBe(false)
|
18
18
|
})
|
19
19
|
|
20
|
-
|
20
|
+
xit("another missing character 'x'", () => {
|
21
21
|
const pangram = new Pangram("the quick brown fish jumps over the lazy dog")
|
22
22
|
expect(pangram.isPangram()).toBe(false)
|
23
23
|
})
|
24
24
|
|
25
|
-
|
25
|
+
xit("pangram with underscores", () => {
|
26
26
|
const pangram = new Pangram("the_quick_brown_fox_jumps_over_the_lazy_dog")
|
27
27
|
expect(pangram.isPangram()).toBe(true)
|
28
28
|
})
|
29
29
|
|
30
|
-
|
30
|
+
xit("pangram with numbers", () => {
|
31
31
|
const pangram = new Pangram("the 1 quick brown fox jumps over the 2 lazy dogs")
|
32
32
|
expect(pangram.isPangram()).toBe(true)
|
33
33
|
})
|
34
34
|
|
35
|
-
|
35
|
+
xit('missing letters replaced by numbers', () => {
|
36
36
|
const pangram = new Pangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog")
|
37
37
|
expect(pangram.isPangram()).toBe(false)
|
38
38
|
})
|
39
39
|
|
40
|
-
|
40
|
+
xit('pangram with mixed case and punctuation', () => {
|
41
41
|
const pangram = new Pangram("\"Five quacking Zephyrs jolt my wax bed.\"")
|
42
42
|
expect(pangram.isPangram()).toBe(true)
|
43
43
|
})
|
44
44
|
|
45
|
-
|
45
|
+
xit('pangram with non-ascii characters', () => {
|
46
46
|
const pangram = new Pangram("Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.")
|
47
47
|
expect(pangram.isPangram()).toBe(true)
|
48
48
|
})
|
@@ -7,47 +7,47 @@ describe('PhoneNumber()', () => {
|
|
7
7
|
expect(phone.number()).toEqual('1234567890')
|
8
8
|
})
|
9
9
|
|
10
|
-
|
10
|
+
xit('cleans numbers with dots', () => {
|
11
11
|
const phone = new PhoneNumber('123.456.7890')
|
12
12
|
expect(phone.number()).toEqual('1234567890')
|
13
13
|
})
|
14
14
|
|
15
|
-
|
15
|
+
xit('cleans numbers with multiple spaces', () => {
|
16
16
|
const phone = new PhoneNumber('123 456 7890 ')
|
17
17
|
expect(phone.number()).toEqual('1234567890')
|
18
18
|
})
|
19
19
|
|
20
|
-
|
20
|
+
xit('invalid when 9 digits', () => {
|
21
21
|
const phone = new PhoneNumber('123456789')
|
22
22
|
expect(phone.number()).toEqual(undefined)
|
23
23
|
})
|
24
24
|
|
25
|
-
|
25
|
+
xit('invalid when 11 digits', () => {
|
26
26
|
const phone = new PhoneNumber('21234567890')
|
27
27
|
expect(phone.number()).toEqual(undefined)
|
28
28
|
})
|
29
29
|
|
30
|
-
|
30
|
+
xit('valid when 11 digits and starting with 1', () => {
|
31
31
|
const phone = new PhoneNumber('11234567890')
|
32
32
|
expect(phone.number()).toEqual('1234567890')
|
33
33
|
})
|
34
34
|
|
35
|
-
|
35
|
+
xit('invalid when 12 digits', () => {
|
36
36
|
const phone = new PhoneNumber('321234567890')
|
37
37
|
expect(phone.number()).toEqual(undefined)
|
38
38
|
})
|
39
39
|
|
40
|
-
|
40
|
+
xit('invalid with letters', () => {
|
41
41
|
const phone = new PhoneNumber('123-abc-7890')
|
42
42
|
expect(phone.number()).toEqual(undefined)
|
43
43
|
})
|
44
44
|
|
45
|
-
|
45
|
+
xit('invalid with punctuations', () => {
|
46
46
|
const phone = new PhoneNumber('123-@:!-7890')
|
47
47
|
expect(phone.number()).toEqual(undefined)
|
48
48
|
})
|
49
49
|
|
50
|
-
|
50
|
+
xit('invalid with right number of digits but letters mixed in', () => {
|
51
51
|
const phone = new PhoneNumber('1a2b3c4d5e6f7g8h9i0j')
|
52
52
|
expect(phone.number()).toEqual(undefined)
|
53
53
|
})
|
@@ -7,36 +7,36 @@ describe('Transcriptor', () => {
|
|
7
7
|
expect(transcriptor.toRna('C')).toEqual('G')
|
8
8
|
})
|
9
9
|
|
10
|
-
|
10
|
+
xit('transcribes guanine to cytosine', () => {
|
11
11
|
expect(transcriptor.toRna('G')).toEqual('C')
|
12
12
|
})
|
13
13
|
|
14
|
-
|
14
|
+
xit('transcribes adenine to uracil', () => {
|
15
15
|
expect(transcriptor.toRna('A')).toEqual('U')
|
16
16
|
})
|
17
17
|
|
18
|
-
|
18
|
+
xit('transcribes thymine to adenine', () => {
|
19
19
|
expect(transcriptor.toRna('T')).toEqual('A')
|
20
20
|
})
|
21
21
|
|
22
|
-
|
22
|
+
xit('transcribes all dna nucleotides to their rna complements', () => {
|
23
23
|
expect(transcriptor.toRna('ACGTGGTCTTAA'))
|
24
24
|
.toEqual('UGCACCAGAAUU')
|
25
25
|
})
|
26
26
|
|
27
|
-
|
27
|
+
xit('correctly handles invalid input', () => {
|
28
28
|
expect(() => transcriptor.toRna('U')).toThrowError(
|
29
29
|
'Invalid input DNA.'
|
30
30
|
)
|
31
31
|
})
|
32
32
|
|
33
|
-
|
33
|
+
xit('correctly handles completely invalid input', () => {
|
34
34
|
expect(() => transcriptor.toRna('XXX')).toThrowError(
|
35
35
|
'Invalid input DNA.'
|
36
36
|
)
|
37
37
|
})
|
38
38
|
|
39
|
-
|
39
|
+
xit('correctly handles partially invalid input', () => {
|
40
40
|
expect(() => transcriptor.toRna('ACGTXXXCTTAA')).toThrowError(
|
41
41
|
'Invalid input DNA.'
|
42
42
|
)
|
@@ -11,16 +11,16 @@ describe('Robot', () => {
|
|
11
11
|
expect(robot.name).toMatch(/^[A-Z]{2}\d{3}$/)
|
12
12
|
})
|
13
13
|
|
14
|
-
|
14
|
+
xit('name is the same each time', () => {
|
15
15
|
expect(robot.name).toEqual(robot.name)
|
16
16
|
})
|
17
17
|
|
18
|
-
|
18
|
+
xit('different robots have different names', () => {
|
19
19
|
const differentRobot = new RobotName()
|
20
20
|
expect(differentRobot.name).not.toEqual(robot.name)
|
21
21
|
})
|
22
22
|
|
23
|
-
|
23
|
+
xit('is able to reset the name', () => {
|
24
24
|
const originalName = robot.name
|
25
25
|
|
26
26
|
robot.resetName()
|
@@ -30,7 +30,7 @@ describe('Robot', () => {
|
|
30
30
|
expect(originalName).not.toEqual(newName)
|
31
31
|
})
|
32
32
|
|
33
|
-
|
33
|
+
xit('should set a unique name after reset', () => {
|
34
34
|
const NUMBER_OF_ROBOTS = 10000
|
35
35
|
const usedNames = new Set()
|
36
36
|
|
@@ -43,12 +43,12 @@ describe('Robot', () => {
|
|
43
43
|
expect(usedNames.size).toEqual(NUMBER_OF_ROBOTS + 1)
|
44
44
|
})
|
45
45
|
|
46
|
-
|
46
|
+
xit('internal name cannot be modified', () => {
|
47
47
|
const modifyInternal = () => robot.name += "a modification"
|
48
48
|
expect(modifyInternal).toThrow()
|
49
49
|
})
|
50
50
|
|
51
|
-
|
51
|
+
xit('new names should not be sequential', () => {
|
52
52
|
const name1 = robot.name
|
53
53
|
const name2 = (new RobotName()).name
|
54
54
|
const name3 = (new RobotName()).name
|
@@ -57,7 +57,7 @@ describe('Robot', () => {
|
|
57
57
|
expect(areSequential(name2, name3)).toBe(false)
|
58
58
|
})
|
59
59
|
|
60
|
-
|
60
|
+
xit('names from reset should not be sequential', () => {
|
61
61
|
const name1 = robot.name
|
62
62
|
robot.resetName()
|
63
63
|
const name2 = robot.name
|
@@ -6,56 +6,56 @@ describe('say', () => {
|
|
6
6
|
expect(say.inEnglish(0)).toBe('zero')
|
7
7
|
})
|
8
8
|
|
9
|
-
|
9
|
+
xit('one', () => {
|
10
10
|
expect(say.inEnglish(1)).toBe('one')
|
11
11
|
})
|
12
12
|
|
13
|
-
|
13
|
+
xit('fourteen', () => {
|
14
14
|
expect(say.inEnglish(14)).toBe('fourteen')
|
15
15
|
})
|
16
16
|
|
17
|
-
|
17
|
+
xit('twenty', () => {
|
18
18
|
expect(say.inEnglish(20)).toBe('twenty')
|
19
19
|
})
|
20
20
|
|
21
|
-
|
21
|
+
xit('twenty-two', () => {
|
22
22
|
expect(say.inEnglish(22)).toBe('twenty-two')
|
23
23
|
})
|
24
24
|
|
25
|
-
|
25
|
+
xit('one hundred', () => {
|
26
26
|
expect(say.inEnglish(100)).toBe('one hundred')
|
27
27
|
})
|
28
28
|
|
29
|
-
|
29
|
+
xit('one hundred twenty-three', () => {
|
30
30
|
expect(say.inEnglish(123)).toBe('one hundred twenty-three')
|
31
31
|
})
|
32
32
|
|
33
|
-
|
33
|
+
xit('one thousand', () => {
|
34
34
|
expect(say.inEnglish(1000)).toBe('one thousand')
|
35
35
|
})
|
36
36
|
|
37
|
-
|
37
|
+
xit('one thousand two hundred thirty-four', () => {
|
38
38
|
expect(say.inEnglish(1234)).toBe('one thousand two hundred thirty-four')
|
39
39
|
})
|
40
40
|
|
41
|
-
|
41
|
+
xit('one million', () => {
|
42
42
|
expect(say.inEnglish(1000000)).toBe('one million')
|
43
43
|
})
|
44
44
|
|
45
|
-
|
45
|
+
xit('one million two', () => {
|
46
46
|
expect(say.inEnglish(1000002)).toBe('one million two')
|
47
47
|
})
|
48
48
|
|
49
|
-
|
49
|
+
xit('one million two thousand three hundred forty-five', () => {
|
50
50
|
expect(say.inEnglish(1002345))
|
51
51
|
.toBe('one million two thousand three hundred forty-five')
|
52
52
|
})
|
53
53
|
|
54
|
-
|
54
|
+
xit('one billion', () => {
|
55
55
|
expect(say.inEnglish(1000000000)).toBe('one billion')
|
56
56
|
})
|
57
57
|
|
58
|
-
|
58
|
+
xit('a really big number', () => {
|
59
59
|
let expected = 'nine hundred eighty-seven billion '
|
60
60
|
expected += 'six hundred fifty-four million '
|
61
61
|
expected += 'three hundred twenty-one thousand '
|
@@ -63,13 +63,13 @@ describe('say', () => {
|
|
63
63
|
expect(say.inEnglish(987654321123)).toBe(expected)
|
64
64
|
})
|
65
65
|
|
66
|
-
|
66
|
+
xit('raises an error below zero', () => {
|
67
67
|
expect(() => {
|
68
68
|
say.inEnglish(-1)
|
69
69
|
}).toThrowError('Number must be between 0 and 999,999,999,999.')
|
70
70
|
})
|
71
71
|
|
72
|
-
|
72
|
+
xit('raises an error above 999,999,999,999', () => {
|
73
73
|
expect(() => {
|
74
74
|
say.inEnglish(1000000000000)
|
75
75
|
}).toThrowError('Number must be between 0 and 999,999,999,999.')
|
@@ -7,48 +7,48 @@ describe('Space Age', () => {
|
|
7
7
|
expect(age.seconds).toEqual(1000000)
|
8
8
|
})
|
9
9
|
|
10
|
-
|
10
|
+
xit('age in earth years', () => {
|
11
11
|
const age = new SpaceAge(1000000000)
|
12
12
|
expect(age.onEarth()).toEqual(31.69)
|
13
13
|
})
|
14
14
|
|
15
|
-
|
15
|
+
xit('age in mercury years', () => {
|
16
16
|
const age = new SpaceAge(2134835688)
|
17
17
|
expect(age.onEarth()).toEqual(67.65)
|
18
18
|
expect(age.onMercury()).toEqual(280.88)
|
19
19
|
})
|
20
20
|
|
21
|
-
|
21
|
+
xit('age in venus years', () => {
|
22
22
|
const age = new SpaceAge(189839836)
|
23
23
|
expect(age.onEarth()).toEqual(6.02)
|
24
24
|
expect(age.onVenus()).toEqual(9.78)
|
25
25
|
})
|
26
26
|
|
27
|
-
|
27
|
+
xit('age in mars years', () => {
|
28
28
|
const age = new SpaceAge(2329871239)
|
29
29
|
expect(age.onEarth()).toEqual(73.83)
|
30
30
|
expect(age.onMars()).toEqual(39.25)
|
31
31
|
})
|
32
32
|
|
33
|
-
|
33
|
+
xit('age in jupiter years', () => {
|
34
34
|
const age = new SpaceAge(901876382)
|
35
35
|
expect(age.onEarth()).toEqual(28.58)
|
36
36
|
expect(age.onJupiter()).toEqual(2.41)
|
37
37
|
})
|
38
38
|
|
39
|
-
|
39
|
+
xit('age in saturn years', () => {
|
40
40
|
const age = new SpaceAge(3000000000)
|
41
41
|
expect(age.onEarth()).toEqual(95.06)
|
42
42
|
expect(age.onSaturn()).toEqual(3.23)
|
43
43
|
})
|
44
44
|
|
45
|
-
|
45
|
+
xit('age in uranus years', () => {
|
46
46
|
const age = new SpaceAge(3210123456)
|
47
47
|
expect(age.onEarth()).toEqual(101.72)
|
48
48
|
expect(age.onUranus()).toEqual(1.21)
|
49
49
|
})
|
50
50
|
|
51
|
-
|
51
|
+
xit('age in neptune year', () => {
|
52
52
|
const age = new SpaceAge(8210123456)
|
53
53
|
expect(age.onEarth()).toEqual(260.16)
|
54
54
|
expect(age.onNeptune()).toEqual(1.58)
|
@@ -8,57 +8,57 @@ describe('words()', () => {
|
|
8
8
|
expect(words.count('word')).toEqual(expectedCounts)
|
9
9
|
})
|
10
10
|
|
11
|
-
|
11
|
+
xit('counts one of each', () => {
|
12
12
|
const expectedCounts = new Map(Object.entries({ one: 1, of: 1, each: 1 }))
|
13
13
|
expect(words.count('one of each')).toEqual(expectedCounts)
|
14
14
|
})
|
15
15
|
|
16
|
-
|
16
|
+
xit('counts multiple occurrences', () => {
|
17
17
|
const expectedCounts = new Map(Object.entries({ one : 1, fish: 4, two: 1, red: 1, blue: 1 }))
|
18
18
|
expect(words.count('one fish two fish red fish blue fish')).toEqual(expectedCounts)
|
19
19
|
})
|
20
20
|
|
21
|
-
|
21
|
+
xit('includes punctuation', () => {
|
22
22
|
const expectedCounts = new Map(Object.entries({ car: 1, ':': 2, carpet: 1, as: 1, java: 1, 'javascript!!&@$%^&': 1 }))
|
23
23
|
expect(words.count('car : carpet as java : javascript!!&@$%^&')).toEqual(expectedCounts)
|
24
24
|
})
|
25
25
|
|
26
|
-
|
26
|
+
xit('includes numbers', () => {
|
27
27
|
const expectedCounts = new Map(Object.entries({ testing: 2, 1: 1, 2: 1 }))
|
28
28
|
expect(words.count('1 2 testing testing')).toEqual(expectedCounts)
|
29
29
|
})
|
30
30
|
|
31
|
-
|
31
|
+
xit('normalizes to lower case', () => {
|
32
32
|
const expectedCounts = new Map(Object.entries({ go: 3 }))
|
33
33
|
expect(words.count('go Go GO')).toEqual(expectedCounts)
|
34
34
|
})
|
35
35
|
|
36
|
-
|
36
|
+
xit('counts properly international characters', () => {
|
37
37
|
const expectedCounts = new Map(Object.entries({ '¡hola!': 1, '¿qué': 1, 'tal?': 1, 'привет!': 1 }))
|
38
38
|
expect(words.count('¡Hola! ¿Qué tal? Привет!')).toEqual(expectedCounts)
|
39
39
|
})
|
40
40
|
|
41
|
-
|
41
|
+
xit('counts multiline', () => {
|
42
42
|
const expectedCounts = new Map(Object.entries({ hello: 1, world: 1 }))
|
43
43
|
expect(words.count('hello\nworld')).toEqual(expectedCounts)
|
44
44
|
})
|
45
45
|
|
46
|
-
|
46
|
+
xit('counts tabs', () => {
|
47
47
|
const expectedCounts = new Map(Object.entries({ hello: 1, world: 1 }))
|
48
48
|
expect(words.count('hello\tworld')).toEqual(expectedCounts)
|
49
49
|
})
|
50
50
|
|
51
|
-
|
51
|
+
xit('counts multiple spaces as one', () => {
|
52
52
|
const expectedCounts = new Map(Object.entries({ hello: 1, world: 1 }))
|
53
53
|
expect(words.count('hello world')).toEqual(expectedCounts)
|
54
54
|
})
|
55
55
|
|
56
|
-
|
56
|
+
xit('does not count leading or trailing whitespace', () => {
|
57
57
|
const expectedCounts = new Map(Object.entries({ introductory: 1, course: 1 }))
|
58
58
|
expect(words.count('\t\tIntroductory Course ')).toEqual(expectedCounts)
|
59
59
|
})
|
60
60
|
|
61
|
-
|
61
|
+
xit('handles properties that exist on Object’s prototype', () => {
|
62
62
|
const expectedCounts = new Map(Object.entries({ reserved: 1, words : 1, like : 1, constructor: 1, and : 1, tostring: 1, 'ok?': 1}))
|
63
63
|
expect(words.count('reserved words like constructor and toString ok?')).toEqual(expectedCounts)
|
64
64
|
})
|