-
Notifications
You must be signed in to change notification settings - Fork 12
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 #215 from radixdlt/fix-persona-data
fix: prevent error when personaData has empty arrays
- Loading branch information
Showing
2 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/data-request/transformations/wallet-data-to-connect-button.spec.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,32 @@ | ||
|
||
import { transformWalletDataToConnectButton } from './wallet-data-to-connect-button' | ||
describe('transformWalletDataToConnectButton', () => { | ||
describe('when persona data contain empty arrays', () => { | ||
it('should not fail', () => { | ||
// Arrange | ||
const walletData = { | ||
personaData: [ | ||
{ | ||
entry: 'emailAddresses', | ||
fields: [], | ||
}, | ||
{ | ||
entry: 'phoneNumbers', | ||
fields: [], | ||
}, | ||
], | ||
} as any | ||
|
||
// Act | ||
const result = transformWalletDataToConnectButton(walletData) | ||
|
||
// Assert | ||
expect(result).toEqual({ | ||
accounts: [], | ||
personaLabel: '', | ||
connected: false, | ||
personaData: [], | ||
}) | ||
}) | ||
}) | ||
}) |
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