Skip to content

Commit

Permalink
test: branch coverage 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
hotoo committed May 7, 2019
1 parent 7567b16 commit 8a2ef27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/EmojiCharString.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class EmojiCharString extends String {
if (typeof string !== 'string') {
throw new Error('Input must be a string')
}
// Compiled code includes || logic, test cases can not cover some branch.
/* istanbul ignore next */
super(string)
this._string = string
this._match = string.match(astralRange) || []
Expand Down Expand Up @@ -87,6 +89,7 @@ class EmojiCharString extends String {
if (separator === '') {
return this._match.slice(0)
}
/* istanbul ignore next */
return super.split(separator)
}

Expand All @@ -95,6 +98,7 @@ class EmojiCharString extends String {
}

indexOf (ch, from) {
/* istanbul ignore next */
const idx = super.indexOf(ch, from)
if (idx === -1) {
return -1
Expand Down
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,6 @@ describe('EmojiCharString Class indexOf method', () => {
assert.equal(emojiStr.indexOf('o'), 2)
assert.equal(emojiStr.indexOf('o', -1), 2)
assert.equal(emojiStr.indexOf('o', emojiStrLen + 1), -1)
assert.equal(emojiStr.indexOf(''), 0)
})
})

0 comments on commit 8a2ef27

Please sign in to comment.