diff options
Diffstat (limited to 'ui/app/helpers')
-rw-r--r-- | ui/app/helpers/common.util.js | 5 | ||||
-rw-r--r-- | ui/app/helpers/tests/common.util.test.js | 23 | ||||
-rw-r--r-- | ui/app/helpers/transactions.util.js | 2 |
3 files changed, 28 insertions, 2 deletions
diff --git a/ui/app/helpers/common.util.js b/ui/app/helpers/common.util.js new file mode 100644 index 000000000..d4acb9968 --- /dev/null +++ b/ui/app/helpers/common.util.js @@ -0,0 +1,5 @@ +export function camelCaseToCapitalize (str) { + return str + .replace(/([A-Z])/g, ' $1') + .replace(/^./, str => str.toUpperCase()) +} diff --git a/ui/app/helpers/tests/common.util.test.js b/ui/app/helpers/tests/common.util.test.js new file mode 100644 index 000000000..891e19ef5 --- /dev/null +++ b/ui/app/helpers/tests/common.util.test.js @@ -0,0 +1,23 @@ +import * as utils from '../common.util' +import assert from 'assert' + +describe('Common utils', () => { + describe('camelCaseToCapitalize', () => { + it('should return a capitalized string from a camel-cased string', () => { + const tests = [ + { + test: '', + expected: '', + }, + { + test: 'thisIsATest', + expected: 'This Is A Test', + }, + ] + + tests.forEach(({ test, expected }) => { + assert.equal(utils.camelCaseToCapitalize(test), expected) + }) + }) + }) +}) diff --git a/ui/app/helpers/transactions.util.js b/ui/app/helpers/transactions.util.js index 8b87bb538..fdad63a96 100644 --- a/ui/app/helpers/transactions.util.js +++ b/ui/app/helpers/transactions.util.js @@ -80,8 +80,6 @@ export async function getTransactionActionKey (transaction, methodData) { return APPROVE_ACTION_KEY case TOKEN_METHOD_TRANSFER_FROM: return TRANSFER_FROM_ACTION_KEY - default: - return name } } else { return SEND_ETHER_ACTION_KEY |