-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #939 from multiversx/development
v2.21.1
- Loading branch information
Showing
21 changed files
with
484 additions
and
300 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
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
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
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
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
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,54 @@ | ||
import { builtCallbackUrl } from '../builtCallbackUrl'; | ||
|
||
describe('builtCallbackUrl tests', () => { | ||
const url = 'https://wallet.multiversx.com'; | ||
|
||
test('returns callbackUrl unmodified if urlParams is empty', () => { | ||
expect(builtCallbackUrl({ callbackUrl: url })).toBe(url); | ||
}); | ||
|
||
test('adds urlParams', () => { | ||
expect( | ||
builtCallbackUrl({ | ||
callbackUrl: url, | ||
urlParams: { status: 'success' } | ||
}) | ||
).toBe('https://wallet.multiversx.com/?status=success'); | ||
}); | ||
|
||
test('adds urlParams and keeps existing hash', () => { | ||
expect( | ||
builtCallbackUrl({ | ||
callbackUrl: url + '#test', | ||
urlParams: { status: 'success' } | ||
}) | ||
).toBe('https://wallet.multiversx.com/?status=success#test'); | ||
}); | ||
|
||
test('keeps existing urlParams', () => { | ||
expect( | ||
builtCallbackUrl({ | ||
callbackUrl: url + '?page=1', | ||
urlParams: { status: 'success' } | ||
}) | ||
).toBe('https://wallet.multiversx.com/?page=1&status=success'); | ||
}); | ||
|
||
test('keeps existing hash', () => { | ||
expect( | ||
builtCallbackUrl({ | ||
callbackUrl: url + '?page=1#logs', | ||
urlParams: { status: 'success' } | ||
}) | ||
).toBe('https://wallet.multiversx.com/?page=1&status=success#logs'); | ||
}); | ||
|
||
test('throws error if callbackUrl is invalid and urlParams are defined', () => { | ||
expect( | ||
builtCallbackUrl({ | ||
callbackUrl: '', | ||
urlParams: { status: 'success' } | ||
}) | ||
).toBe(''); | ||
}); | ||
}); |
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,7 @@ | ||
import { getWindowLocation } from './index'; | ||
|
||
export const getDefaultCallbackUrl = () => { | ||
const { pathname, search, hash } = getWindowLocation(); | ||
|
||
return `${pathname ?? ''}${search ?? ''}${hash ?? ''}`; | ||
}; |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './addOriginToLocationPath'; | ||
export * from './getDefaultCallbackUrl'; | ||
export * from './getWindowLocation'; |
Oops, something went wrong.