-
Notifications
You must be signed in to change notification settings - Fork 295
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 #2966 from input-output-hk/fix/ddw-1086-fix-phrasi…
…ng-of-insufficient-funds-for-tokens-message [DDW-1086] Fix phrasing of insufficient funds for tokens message
- Loading branch information
Showing
12 changed files
with
150 additions
and
37 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
88 changes: 88 additions & 0 deletions
88
source/renderer/app/containers/wallet/dialogs/send-confirmation/helpers.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,88 @@ | ||
import BigNumber from 'bignumber.js'; | ||
import { hasAssetsAfterTransaction } from './helpers'; | ||
|
||
const assetWithOneQuantity = { | ||
policyId: 'policyId1', | ||
assetName: '54657374636f696e', | ||
quantity: new BigNumber(1), | ||
fingerprint: 'policyId154657374636f696e', | ||
metadata: { | ||
name: 'Testcoin', | ||
description: 'Test coin', | ||
}, | ||
uniqueId: 'uniqueId1', | ||
decimals: 1, | ||
recommendedDecimals: null, | ||
}; | ||
|
||
const assetWithTenQuantity = { | ||
policyId: 'policyId2', | ||
assetName: '436f696e74657374', | ||
quantity: new BigNumber(10), | ||
fingerprint: 'policyId2436f696e74657374', | ||
uniqueId: 'uniqueId2', | ||
decimals: 1, | ||
recommendedDecimals: null, | ||
}; | ||
|
||
describe('hasAssetsAfterTransaction', () => { | ||
test('Should be true when wallet has assets and tx sending no assets', () => { | ||
expect( | ||
hasAssetsAfterTransaction({ | ||
assetTokens: [assetWithOneQuantity, assetWithTenQuantity], | ||
selectedAssets: [], | ||
assetsAmounts: [], | ||
}) | ||
).toEqual(true); | ||
}); | ||
|
||
test('Should be true when wallet has assets and tx is not sending all asset types', () => { | ||
expect( | ||
hasAssetsAfterTransaction({ | ||
assetTokens: [assetWithOneQuantity, assetWithTenQuantity], | ||
selectedAssets: [assetWithTenQuantity], | ||
assetsAmounts: ['5'], | ||
}) | ||
).toEqual(true); | ||
}); | ||
|
||
test('Should be true when wallet has assets and tx is not sending all assets', () => { | ||
expect( | ||
hasAssetsAfterTransaction({ | ||
assetTokens: [assetWithOneQuantity, assetWithTenQuantity], | ||
selectedAssets: [assetWithOneQuantity, assetWithTenQuantity], | ||
assetsAmounts: ['1', '5'], | ||
}) | ||
).toEqual(true); | ||
}); | ||
|
||
test('Should be false when wallet has no assets', () => { | ||
expect( | ||
hasAssetsAfterTransaction({ | ||
assetTokens: [], | ||
selectedAssets: [], | ||
assetsAmounts: [], | ||
}) | ||
).toEqual(false); | ||
}); | ||
|
||
test('Should be false when tx is sending all assets (1 asset)', () => { | ||
expect( | ||
hasAssetsAfterTransaction({ | ||
assetTokens: [assetWithOneQuantity], | ||
selectedAssets: [assetWithOneQuantity], | ||
assetsAmounts: ['1'], | ||
}) | ||
).toEqual(false); | ||
}); | ||
|
||
test('Should be false when tx is sending all assets (2 assets)', () => { | ||
expect( | ||
hasAssetsAfterTransaction({ | ||
assetTokens: [assetWithOneQuantity, assetWithTenQuantity], | ||
selectedAssets: [assetWithOneQuantity, assetWithTenQuantity], | ||
assetsAmounts: ['1', '10'], | ||
}) | ||
).toEqual(false); | ||
}); | ||
}); |
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