Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Introduces unit tests for bravifyText #8214

Merged
merged 2 commits into from
Apr 11, 2017
Merged

Introduces unit tests for bravifyText #8214

merged 2 commits into from
Apr 11, 2017

Conversation

jonathansampson
Copy link
Collaborator

@jonathansampson jonathansampson commented Apr 10, 2017

Automated test plan

npm run unittest -- --grep="extensionsUtil bravifyText"

Description

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Fixes #8213

result = result.replace(/\s+/g,' ')
expected = expected.replace(/\s+/g,' ')
result = result.replace(/\s+/g, ' ')
expected = expected.replace(/\s+/g, ' ')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing a lint error (my bad on this one- I committed from Windows which doesn't run the npm run lint prehook)

'This Chrome extension is the best one in the Google Chrome store. Use Chrome today!'),
'This Brave extension is the best one in the Brave store. Use Brave today!')
})
it('does not replace Google', function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test to make sure we don't (going forward, if this changes, etc) replace Google since valid extensions use it

it('does a global replace (more than one occurrence)', function () {
assert.equal(extensionsUtil.bravifyText(
'This Chrome extension is the best one in the Google Chrome store. Use Chrome today!'),
'This Brave extension is the best one in the Brave store. Use Brave today!')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you had the /g in there, wanted to enforce that this should replace multiple types / occurrences 😄

assert.equal(extensionsUtil.bravifyText('Google Docs'), 'Google Docs')
})
it('does not replace lowercase c `chrome`', function () {
assert.equal(extensionsUtil.bravifyText('Shiny chrome plated thing'), 'Shiny chrome plated thing')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chrome != Chrome 😎

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call on adding these tests; I left the regex case-sensitive to avoid conflating the browser with the region of the browser sharing the same name :) Glad you did an explicit test.

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@bbondy
Copy link
Member

bbondy commented Apr 13, 2017

cliftinifyCode(code) => tested_code

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants