Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
test(unit): support msats
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Mar 29, 2020
1 parent 62254c2 commit d1da8ee
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/unit/utils/btc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ describe('satoshi to..', () => {
expect(satoshisToBtc('1')).toEqual('0.00000001')
})

it('should return 0.00000002 when a between 1 and 2 satoshi value is passed in', () => {
expect(satoshisToBtc(1.5)).toEqual('0.00000002')
expect(satoshisToBtc('1.5')).toEqual('0.00000002')
it('should return 0.000000015 when 1.5 satoshi value is passed in', () => {
expect(satoshisToBtc(1.5)).toEqual('0.000000015')
expect(satoshisToBtc('1.5')).toEqual('0.000000015')
})
})

Expand Down Expand Up @@ -178,9 +178,9 @@ describe('millisatoshis to..', () => {
expect(millisatoshisToBits('100000')).toEqual('1')
})

it('should return 1.23 when 123,456 millisatoshis are passed in', () => {
expect(millisatoshisToBits(123456)).toEqual('1.23')
expect(millisatoshisToBits('123456')).toEqual('1.23')
it('should return 1.23 when 123,45678 millisatoshis are passed in', () => {
expect(millisatoshisToBits(123456)).toEqual('1.23456')
expect(millisatoshisToBits('123456')).toEqual('1.23456')
})
})

Expand All @@ -189,6 +189,11 @@ describe('millisatoshis to..', () => {
expect(millisatoshisToSatoshis(1000)).toEqual('1')
expect(millisatoshisToSatoshis('1000')).toEqual('1')
})

it('should return 0.001 when 1 millisatoshis are passed in', () => {
expect(millisatoshisToSatoshis(1)).toEqual('0.001')
expect(millisatoshisToSatoshis('1')).toEqual('0.001')
})
})

describe('millisatoshisToFiat', () => {
Expand Down

0 comments on commit d1da8ee

Please sign in to comment.