Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/__tests__/cashMethods.test.js
Show All 24 Lines | import { | ||||
generateTokenTxOutput, | generateTokenTxOutput, | ||||
getCashtabByteCount, | getCashtabByteCount, | ||||
calcFee, | calcFee, | ||||
toHash160, | toHash160, | ||||
generateGenesisOpReturn, | generateGenesisOpReturn, | ||||
generateSendOpReturn, | generateSendOpReturn, | ||||
generateBurnOpReturn, | generateBurnOpReturn, | ||||
getECPairFromWIF, | getECPairFromWIF, | ||||
hash160ToAddress, | |||||
} from 'utils/cashMethods'; | } from 'utils/cashMethods'; | ||||
import { currency } from 'components/Common/Ticker'; | import { currency } from 'components/Common/Ticker'; | ||||
import { validAddressArrayInput } from '../__mocks__/mockAddressArray'; | import { validAddressArrayInput } from '../__mocks__/mockAddressArray'; | ||||
import { | import { | ||||
mockGenesisOpReturnScript, | mockGenesisOpReturnScript, | ||||
mockSendOpReturnScript, | mockSendOpReturnScript, | ||||
mockSendOpReturnTokenUtxos, | mockSendOpReturnTokenUtxos, | ||||
mockBurnOpReturnScript, | mockBurnOpReturnScript, | ||||
▲ Show 20 Lines • Show All 1,518 Lines • ▼ Show 20 Lines | it('calculates fee correctly for 2 P2PKH outputs', () => { | ||||
const utxosMock = [{}, {}]; | const utxosMock = [{}, {}]; | ||||
expect(calcFee(utxosMock, 2, 1.01)).toBe(378); | expect(calcFee(utxosMock, 2, 1.01)).toBe(378); | ||||
}); | }); | ||||
it(`Gets correct EC Pair from WIF`, () => { | it(`Gets correct EC Pair from WIF`, () => { | ||||
expect(JSON.stringify(getECPairFromWIF(mockWif))).toBe( | expect(JSON.stringify(getECPairFromWIF(mockWif))).toBe( | ||||
mockStringifiedECPair, | mockStringifiedECPair, | ||||
); | ); | ||||
}); | }); | ||||
it(`Converts a hash160 to an ecash address`, () => { | |||||
expect( | |||||
hash160ToAddress('76458db0ed96fe9863fc1ccec9fa2cfab884b0f6'), | |||||
).toBe('ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj'); | |||||
}); | |||||
}); | }); |