-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46940f0
commit 80f5a8f
Showing
3 changed files
with
59 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": patch | ||
--- | ||
|
||
Fix split address that didn't take in consideration special characters (cf Hedera) |
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
38 changes: 38 additions & 0 deletions
38
apps/ledger-live-desktop/src/renderer/components/OperationsList/tests/splitAddress.test.ts
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,38 @@ | ||
import { splitAddress } from "../AddressCell"; | ||
|
||
describe("splitAddress", () => { | ||
it("should split address with a dot correctly", () => { | ||
const result = splitAddress("0.0.931774"); | ||
expect(result).toEqual({ left: "0.", right: "0.931774" }); | ||
}); | ||
|
||
it("should split address with a special character and a dot correctly", () => { | ||
const result = splitAddress("abc.def-ghi"); | ||
expect(result).toEqual({ left: "abc.", right: "def-ghi" }); | ||
}); | ||
|
||
it("should split address with a special characters", () => { | ||
const result = splitAddress("abc-def-ghi"); | ||
expect(result).toEqual({ left: "abc-", right: "def-ghi" }); | ||
}); | ||
|
||
it("should split address without a dot correctly", () => { | ||
const result = splitAddress("abcdefghi"); | ||
expect(result).toEqual({ left: "abc", right: "defghi" }); | ||
}); | ||
|
||
it("should handle empty string", () => { | ||
const result = splitAddress(""); | ||
expect(result).toEqual({ left: "", right: "" }); | ||
}); | ||
|
||
it("should handle string with one character", () => { | ||
const result = splitAddress("a"); | ||
expect(result).toEqual({ left: "", right: "a" }); | ||
}); | ||
|
||
it("should handle string with two characters", () => { | ||
const result = splitAddress("ab"); | ||
expect(result).toEqual({ left: "a", right: "b" }); | ||
}); | ||
}); |