-
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.
fix: prevent error when personaData has empty arrays
- Loading branch information
1 parent
ce2f00e
commit 108bc77
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...modules/wallet-request/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 { describe, expect, it } from 'vitest' | ||
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