-
-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Promote two-fer to core and sync to 1.2.0 (#649)
* Promote two-fer to core And make sure we expect an optional argument, instead of passing in null, requiring boolean logic.
- Loading branch information
1 parent
374ac3a
commit 0292639
Showing
3 changed files
with
22 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") | ||
}) | ||
}) |