Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/__tests__/validation.test.js
import { | import { | ||||
shouldRejectAmountInput, | shouldRejectAmountInput, | ||||
fiatToCrypto, | fiatToCrypto, | ||||
isValidTokenName, | isValidTokenName, | ||||
isValidTokenTicker, | isValidTokenTicker, | ||||
isValidTokenDecimals, | isValidTokenDecimals, | ||||
isValidTokenInitialQty, | isValidTokenInitialQty, | ||||
isValidTokenDocumentUrl, | isValidTokenDocumentUrl, | ||||
isValidTokenStats, | isValidTokenStats, | ||||
isValidCashtabSettings, | isValidCashtabSettings, | ||||
isValidXecAddress, | isValidXecAddress, | ||||
isValidNewWalletNameLength, | |||||
isValidEtokenAddress, | isValidEtokenAddress, | ||||
isValidXecSendAmount, | isValidXecSendAmount, | ||||
isValidSendToMany, | isValidSendToMany, | ||||
isValidUtxo, | isValidUtxo, | ||||
isValidBchApiUtxoObject, | isValidBchApiUtxoObject, | ||||
isValidEtokenBurnAmount, | isValidEtokenBurnAmount, | ||||
isValidTokenId, | isValidTokenId, | ||||
isValidXecAirdrop, | isValidXecAirdrop, | ||||
▲ Show 20 Lines • Show All 670 Lines • ▼ Show 20 Lines | it('does nothing if valid settings object is present in localStorage', () => | ||||
sendModal: true, | sendModal: true, | ||||
autoCameraOn: true, | autoCameraOn: true, | ||||
}), | }), | ||||
).toStrictEqual({ | ).toStrictEqual({ | ||||
fiatCurrency: 'brl', | fiatCurrency: 'brl', | ||||
sendModal: true, | sendModal: true, | ||||
autoCameraOn: true, | autoCameraOn: true, | ||||
})); | })); | ||||
it(`accepts a valid wallet name`, () => { | |||||
expect(isValidNewWalletNameLength('Apollo')).toBe(true); | |||||
}); | |||||
it(`rejects wallet name that is too long`, () => { | |||||
expect( | |||||
isValidNewWalletNameLength( | |||||
'this string is far too long to be used as a wallet name...', | |||||
), | |||||
).toBe(false); | |||||
}); | |||||
it(`rejects blank string as new wallet name`, () => { | |||||
expect(isValidNewWalletNameLength('')).toBe(false); | |||||
}); | |||||
it(`rejects wallet name of the wrong type`, () => { | |||||
expect(isValidNewWalletNameLength(['newWalletName'])).toBe(false); | |||||
}); | |||||
}); | }); |