-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: let use the p and x addresses without prefix
- Loading branch information
Showing
5 changed files
with
28 additions
and
12 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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { correctAddressByPrefix } from './correctAddressByPrefix'; | ||
|
||
describe('src/pages/Send/utils/correctAddressByPrefix', () => { | ||
it('should add the prefix when the address does not start with that', () => { | ||
const address = 'address'; | ||
expect(correctAddressByPrefix(address, 'PREFIX-')).toBe( | ||
`PREFIX-${address}` | ||
); | ||
}); | ||
it('sgould not duplicate the prefix when it is the start of the address', () => { | ||
const address = 'PREFIX-address'; | ||
expect(correctAddressByPrefix(address, 'PREFIX-')).toBe(address); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const correctAddressByPrefix = (address: string, prefix: string) => { | ||
return !address.startsWith(prefix) ? `${prefix}${address}` : address; | ||
}; |
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