Skip to content

Commit

Permalink
Promote two-fer to core and sync to 1.2.0 (#649)
Browse files Browse the repository at this point in the history
* Promote two-fer to core

And make sure we expect an optional argument, instead of passing in null, requiring boolean logic.
  • Loading branch information
SleeplessByte committed Mar 26, 2019
1 parent 374ac3a commit 0292639
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 28 deletions.
26 changes: 12 additions & 14 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
"text_formatting"
]
},
{
"slug": "two-fer",
"uuid": "7f49e997-4435-4f34-a020-bddc92c838ed",
"core": true,
"unlocked_by": null,
"difficulty": 1,
"topics": [
"optional_values",
"strings",
"text_formatting"
]
},
{
"slug": "resistor-color",
"uuid": "53be6837-c224-45f1-bff3-d7f74d6285ce",
Expand Down Expand Up @@ -223,20 +235,6 @@
"games"
]
},
{
"slug": "two-fer",
"uuid": "7f49e997-4435-4f34-a020-bddc92c838ed",
"core": false,
"unlocked_by": "hello-world",
"difficulty": 1,
"topics": [
"booleans",
"logic",
"optional_values",
"strings",
"text_formatting"
]
},
{
"slug": "leap",
"uuid": "7c8294ee-5924-4bf8-a72f-31d0e2d7d9a0",
Expand Down
5 changes: 2 additions & 3 deletions exercises/two-fer/example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export const twoFer = (name) => {
const nameText = name || 'you';
return `One for ${nameText}, one for me.`;
export const twoFer = (name = 'you') => {
return `One for ${name}, one for me.`;
};
19 changes: 8 additions & 11 deletions exercises/two-fer/two-fer.spec.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { twoFer } from './two-fer';
import { twoFer } from './two-fer'

describe('twoFer()', () => {
test('no name given', () => {
const name = '';
expect(twoFer(name)).toEqual('One for you, one for me.');
});
expect(twoFer()).toEqual("One for you, one for me.")
})

xtest('a name given', () => {
const name = 'Alice';
expect(twoFer(name)).toEqual('One for Alice, one for me.');
});
expect(twoFer("Alice")).toEqual("One for Alice, one for me.")
})

xtest('another name given', () => {
const name = 'Bob';
expect(twoFer(name)).toEqual('One for Bob, one for me.');
});
});
expect(twoFer("Bob")).toEqual("One for Bob, one for me.")
})
})

0 comments on commit 0292639

Please sign in to comment.