We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent386c707 commit6ba1597Copy full SHA for 6ba1597
coderoad.json
@@ -531,7 +531,7 @@
531
]
532
},
533
{
534
-"description":"add a `SORT_BY_POPULARITY` case that returns `pokemon.sort();`",
+"description":"back in\"src/pokemon/index.js\",add a `SORT_BY_POPULARITY` case that returns `pokemon.sort();`",
535
"tests": [
536
"09/05"
537
],
@@ -548,7 +548,7 @@
548
"Try this: `case SORT_BY_POPULARITY: return pokemon.sort(sortByVotes)`"
549
550
"actions": [
551
-"insert('\nfunction sortByVotes(a, b) {\n switch(true) {\n case a.votes> b.votes:\n return 1;\n case a.votes< b.votes:\n return -1;\n default: return 0;\n }\n}\n\n')"
+"insert('\nfunction sortByVotes(a, b) {\n switch(true) {\n case a.votes< b.votes:\n return 1;\n case a.votes> b.votes:\n return -1;\n default: return 0;\n }\n}\n\n')"
552
553
554
tutorial/09/04.js
@@ -1,7 +1,7 @@
1
describe('04 sortByPopularity action',()=>{
2
3
it('should be dispatched',()=>{
4
-constregex=/store.dispatch\s?\(\s?sortByPopularity\(\s?\)\s?)/;
+constregex=/store.dispatch\s?\(\s?sortByPopularity\(\s?\)\s?\)/m;
5
expect(indexJs.__text__).to.match(regex);
6
});
7
tutorial/09/05.js
@@ -3,12 +3,12 @@ describe('05 pokemon reducer', () => {
constpokemon=pokemonIndexJs.__get__('pokemon');
it('has a SORT_BY_POPULARITY case',()=>{
-constregex=/case\s?+SORT_BY_POPULARITY/;
+constregex=/case\s+?SORT_BY_POPULARITY\s?:/;
expect(pokemon.toString()).to.match(regex);
8
9
10
it('case SORT_BY_POPULARITY should sort pokemon',()=>{
11
-constregex=/pokemon.sort(.*)/;
+constregex=/case\s+?SORT_BY_POPULARITY\s?:\n?\s+?return\s+?pokemon.sort\(/;
12
13
14
tutorial/09/06.js
@@ -1,6 +1,6 @@
describe('06 sortByVotes function',()=>{
-if(Number(process.env.TASK_POSITION)<=5){
+//if (Number(process.env.TASK_POSITION) <= 5) {
constsortByVotes=pokemonIndexJs.__get__('sortByVotes');
@@ -18,19 +18,11 @@ describe('06 sortByVotes function', () => {
18
19
20
21
-it('should sort a list of objects with vote',()=>{
22
-constlist=[{votes:3},{votes:1},{votes:2}];
23
-expect(list.sort(sortByVotes)).to.not.deep.equal(list);
24
-});
25
-
26
it('should sort a list in descending order',()=>{
27
constlist=[{votes:3},{votes:1},{votes:2}];
28
constexpected=[{votes:3},{votes:2},{votes:1}];
29
expect(list.sort(sortByVotes)).to.deep.equal(expected);
30
31
32
-}else{
33
-it('passes',()=>expect(true).to.be(true));
34
-}
35
+// }
36
tutorial/09/07.js
@@ -14,11 +14,6 @@ describe('07 sortByKey function', () => {
expect(sortByKey).to.have.length(1);
15
16
17
-it('should sort a list of objects by a key',()=>{
-constlist=[{a:3},{a:1},{a:2}];
-expect(list.sort(sortByKey('a'))).to.not.deep.equal(list);
constlist=[{a:3},{a:1},{a:2}];
constexpected=[{a:3},{a:2},{a:1}];
tutorial/09/index.md
@@ -33,7 +33,7 @@ Sort pokemon by votes
@hint('use`store.dispatch(actionCreator)`')
@hint('Try this:`store.dispatch(sortByPopularity())`')
-+ add a`SORT_BY_POPULARITY` case that returns`pokemon.sort();`
++back in "src/pokemon/index.js",add a`SORT_BY_POPULARITY` case that returns`pokemon.sort();`
37
@test('09/05')
38
@hint('Try this:`case SORT_BY_POPULARITY: return pokemon.sort()`')
39
@@ -45,9 +45,9 @@ Sort pokemon by votes
45
46
function sortByVotes(a, b) {
47
switch(true) {
48
- case a.votes > b.votes:
49
- return 1;
50
case a.votes < b.votes:
+ return 1;
+ case a.votes > b.votes:
51
return -1;
52
default: return 0;
53
}