-
Notifications
You must be signed in to change notification settings - Fork 975
Introduces unit tests for bravifyText #8214
Conversation
result = result.replace(/\s+/g,' ') | ||
expected = expected.replace(/\s+/g,' ') | ||
result = result.replace(/\s+/g, ' ') | ||
expected = expected.replace(/\s+/g, ' ') |
There was a problem hiding this comment.
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 () { |
There was a problem hiding this comment.
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!') |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chrome != Chrome 😎
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
cliftinifyCode(code) => tested_code |
Automated test plan
npm run unittest -- --grep="extensionsUtil bravifyText"
Description
git rebase -i
to squash commits (if needed).Fixes #8213