Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/__tests__/cashMethods.test.js
Show First 20 Lines • Show All 1,138 Lines • ▼ Show 20 Lines | describe('Correctly executes cash utility functions', () => { | ||||
it(`Accepts a cachedWalletState that has not preserved BigNumber object types, and returns the same wallet state with BigNumber type re-instituted`, () => { | it(`Accepts a cachedWalletState that has not preserved BigNumber object types, and returns the same wallet state with BigNumber type re-instituted`, () => { | ||||
expect(loadStoredWallet(cachedUtxos)).toStrictEqual( | expect(loadStoredWallet(cachedUtxos)).toStrictEqual( | ||||
utxosLoadedFromCache, | utxosLoadedFromCache, | ||||
); | ); | ||||
}); | }); | ||||
it(`Correctly determines a wallet's balance from its set of non-eToken utxos (nonSlpUtxos)`, () => { | it(`Correctly determines a wallet's balance from its set of non-eToken utxos (nonSlpUtxos)`, () => { | ||||
expect( | expect( | ||||
getWalletBalanceFromUtxos( | getWalletBalanceFromUtxos( | ||||
validStoredWallet.state.slpBalancesAndUtxos.nonSlpUtxos, | validStoredWalletAfter20221123Streamline.state.nonSlpUtxos, | ||||
), | ), | ||||
).toStrictEqual(validStoredWallet.state.balances); | ).toStrictEqual(validStoredWallet.state.balances); | ||||
}); | }); | ||||
it(`Correctly determines a wallet's zero balance from its empty set of non-eToken utxos (nonSlpUtxos)`, () => { | it(`Correctly determines a wallet's zero balance from its empty set of non-eToken utxos (nonSlpUtxos)`, () => { | ||||
expect( | expect( | ||||
getWalletBalanceFromUtxos( | getWalletBalanceFromUtxos(utxosLoadedFromCache.nonSlpUtxos), | ||||
utxosLoadedFromCache.slpBalancesAndUtxos.nonSlpUtxos, | |||||
), | |||||
).toStrictEqual(utxosLoadedFromCache.balances); | ).toStrictEqual(utxosLoadedFromCache.balances); | ||||
}); | }); | ||||
it(`Recognizes a stored wallet as valid if it has all required fields prior to 20221123 updated format`, () => { | it(`Recognizes a stored wallet as valid if it has all required fields prior to 20221123 updated format`, () => { | ||||
expect(isValidStoredWallet(validStoredWallet)).toBe(true); | expect(isValidStoredWallet(validStoredWallet)).toBe(true); | ||||
}); | }); | ||||
it(`Recognizes a stored wallet as valid if it has all required fields in 20221123 updated format`, () => { | it(`Recognizes a stored wallet as valid if it has all required fields in 20221123 updated format`, () => { | ||||
expect( | expect( | ||||
isValidStoredWallet(validStoredWalletAfter20221123Streamline), | isValidStoredWallet(validStoredWalletAfter20221123Streamline), | ||||
▲ Show 20 Lines • Show All 410 Lines • Show Last 20 Lines |