Skip to content

Commit

Permalink
fix unit test for searchStrToPath
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-ryuji committed Jan 18, 2024
1 parent 51f670a commit 3c2c0a3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/lib/__tests__/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,30 @@ describe('searchStrToPath', () => {
expect(
searchStrToPath(
'GDCX3FBHR7IKHSDFDCA4XY65NF6B2WMF5WR67FIXN5JXURJ3YDGSU2BS',
'/operations', // should be other than '/claimable-balance'
),
).toEqual(
'/account/GDCX3FBHR7IKHSDFDCA4XY65NF6B2WMF5WR67FIXN5JXURJ3YDGSU2BS',
)
})

it('returns /account for federated addresses', () => {
expect(searchStrToPath('steexp*fed.network')).toEqual(
expect(searchStrToPath('steexp*fed.network', '/operations')).toEqual(
'/account/steexp*fed.network',
)
})

it('returns /claimable-balances when path starts with /claimable-balance', () => {
expect(
searchStrToPath(
'GDCX3FBHR7IKHSDFDCA4XY65NF6B2WMF5WR67FIXN5JXURJ3YDGSU2BS',
'/claimable-balance',
),
).toEqual(
'/claimable-balances/GDCX3FBHR7IKHSDFDCA4XY65NF6B2WMF5WR67FIXN5JXURJ3YDGSU2BS',
)
})

it('returns /account/<issuer> for matching asset codes', () => {
expect(searchStrToPath('MOBI')).toEqual('/asset/MOBI')
expect(searchStrToPath('JPY')).toEqual('/asset/JPY')
Expand Down

0 comments on commit 3c2c0a3

Please sign in to comment.