Skip to content

Commit

Permalink
test(Coinify): more service tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Welber committed Jul 5, 2018
1 parent a69b36a commit 6a4fc13
Showing 1 changed file with 195 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as CoinifyService from './index'
import { Remote } from 'blockchain-wallet-v4/src'

fdescribe('CoinifyService', () => {
describe('CoinifyService', () => {
const mockedLimits = (max, min) => ({
bank: {
inRemaining: { EUR: max, USD: 100, GBP: 100, DKK: 100 },
Expand Down Expand Up @@ -36,9 +37,11 @@ fdescribe('CoinifyService', () => {
quoteAmount: 100000,
paymentMediums: {
card: {
fee: 0.1,
outFixedFees: {
BTC: 0.0001
}
},
total: 10.1
}
}
}
Expand Down Expand Up @@ -92,5 +95,195 @@ fdescribe('CoinifyService', () => {
it('should render the amount row', () => {
expect(CoinifyService.reviewOrder.renderAmountRow(baseFiatQuote)).toEqual('€10.00')
})
it('should render the amount row with a base btc quote', () => {
expect(CoinifyService.reviewOrder.renderAmountRow(baseBtcQuote)).toEqual('€10.00')
})
it('should render the fee row', () => {
expect(CoinifyService.reviewOrder.renderFeeRow(baseFiatQuote, 'card', 'buy')).toEqual('€0.10')
})
it('should render the total row', () => {
expect(CoinifyService.reviewOrder.renderTotalRow(baseFiatQuote, 'card', 'buy')).toEqual('€10.10')
})
})
describe('statusHelper', () => {
it('should return the correct object for reviewing status', () => {
const status = CoinifyService.statusHelper('reviewing')
expect(status.text.props.defaultMessage).toEqual('Pending')
})
it('should return the correct object for awaiting_transfer_in status', () => {
const status = CoinifyService.statusHelper('awaiting_transfer_in')
expect(status.text.props.defaultMessage).toEqual('Pending')
})
it('should return the correct object for processing status', () => {
const status = CoinifyService.statusHelper('processing')
expect(status.text.props.defaultMessage).toEqual('Pending')
})
it('should return the correct object for completed status', () => {
const status = CoinifyService.statusHelper('completed')
expect(status.text.props.defaultMessage).toEqual('Completed')
})
it('should return the correct object for rejected status', () => {
const status = CoinifyService.statusHelper('rejected')
expect(status.text.props.defaultMessage).toEqual('Rejected')
})
it('should return the correct object for failed status', () => {
const status = CoinifyService.statusHelper('failed')
expect(status.text.props.defaultMessage).toEqual('Failed')
})
it('should return the correct object for cancelled status', () => {
const status = CoinifyService.statusHelper('cancelled')
expect(status.text.props.defaultMessage).toEqual('Cancelled')
})
it('should return the correct object for expired status', () => {
const status = CoinifyService.statusHelper('expired')
expect(status.text.props.defaultMessage).toEqual('Expired')
})
it('should return the correct object for default', () => {
const status = CoinifyService.statusHelper('unknown')
expect(status.text.props.defaultMessage).toEqual('Unknown')
expect(status.color).toEqual('gray-5')
})
})
describe('bodyStatusHelper', () => {
it('should return the correct text for reviewing status', () => {
const status = CoinifyService.bodyStatusHelper('reviewing', 'buy')
expect(status.text.props.defaultMessage).toEqual('Your purchase is currently being processed. Our exchange partner will send a status update your way within 1 business day.')
})
it('should return the correct text for awaiting transfer in status', () => {
const status = CoinifyService.bodyStatusHelper('awaiting_transfer_in', 'buy')
expect(status.text.props.defaultMessage).toEqual('Your purchase is currently being processed. Our exchange partner will send a status update your way within 1 business day.')
})
it('should return the correct text for processing status', () => {
const status = CoinifyService.bodyStatusHelper('processing', 'buy')
expect(status.text.props.defaultMessage).toEqual('Your purchase is currently being processed. Our exchange partner will send a status update your way within 1 business day.')
})
it('should return the correct text for completed status', () => {
const status = CoinifyService.bodyStatusHelper('completed', 'buy')
expect(status.text.props.defaultMessage).toEqual('Your buy trade is complete!')
})
it('should return the correct text for rejected status', () => {
const status = CoinifyService.bodyStatusHelper('rejected', 'buy')
expect(status.text.props.defaultMessage).toEqual('Your buy trade has been rejected. Please contact support.')
})
})
describe('kycHeaderHelper', () => {
it('should return the correct object for reviewing status', () => {
const status = CoinifyService.kycHeaderHelper('reviewing')
expect(status.text.props.defaultMessage).toEqual('Identity Verification In Review')
})
it('should return the correct object for processing status', () => {
const status = CoinifyService.kycHeaderHelper('processing')
expect(status.text.props.defaultMessage).toEqual('Identity Verification Processing')
})
it('should return the correct object for pending status', () => {
const status = CoinifyService.kycHeaderHelper('pending')
expect(status.text.props.defaultMessage).toEqual('Identity Verification Incomplete')
})
it('should return the correct object for completed status', () => {
const status = CoinifyService.kycHeaderHelper('completed')
expect(status.text.props.defaultMessage).toEqual('Identity Verification Completed')
})
it('should return the correct object for rejected status', () => {
const status = CoinifyService.kycHeaderHelper('rejected')
expect(status.text.props.defaultMessage).toEqual('Identity Verification Denied')
})
it('should return the correct object for failed status', () => {
const status = CoinifyService.kycHeaderHelper('failed')
expect(status.text.props.defaultMessage).toEqual('Identity Verification Failed')
})
it('should return the correct object for cancelled status', () => {
const status = CoinifyService.kycHeaderHelper('cancelled')
expect(status.text.props.defaultMessage).toEqual('Identity Verification Cancelled')
})
it('should return the correct object for expired status', () => {
const status = CoinifyService.kycHeaderHelper('expired')
expect(status.text.props.defaultMessage).toEqual('Identity Verification Expired')
})
it('should return the correct object for default', () => {
const status = CoinifyService.kycHeaderHelper('unknown')
expect(status.text.props.defaultMessage).toEqual('Unknown')
})
})
describe('kycBodyHelper', () => {
it('should return the correct object for reviewing status', () => {
const status = CoinifyService.kycBodyHelper('reviewing')
expect(status.text.props.defaultMessage).toEqual('Your request for authentication has been submitted and will be reviewed shortly. Coinify will email you a status updated within 48 business hours. If you have any questions about the status of your submission, feel free to reach out to Coinify directly at www.coinify.com/support')
})
it('should return the correct object for processing status', () => {
const status = CoinifyService.kycBodyHelper('processing')
expect(status.text.props.defaultMessage).toEqual('Your request for authentication has been submitted and will be reviewed shortly. Coinify will email you a status updated within 48 business hours. If you have any questions about the status of your submission, feel free to reach out to Coinify directly at www.coinify.com/support')
})
it('should return the correct object for pending status', () => {
const status = CoinifyService.kycBodyHelper('pending')
expect(status.text.props.defaultMessage).toEqual('Your identity verification is processing.')
})
it('should return the correct object for completed status', () => {
const status = CoinifyService.kycBodyHelper('completed')
expect(status.text.props.defaultMessage).toEqual('Your identity verification is complete! Your limits have been raised.')
})
it('should return the correct object for rejected status', () => {
const status = CoinifyService.kycBodyHelper('rejected')
expect(status.text.props.defaultMessage).toEqual('There was an issue verifying your identity with the documents provided. Please try uploading different identification. Bank transfers are unavailable until we can successfully verify your identity.')
})
it('should return the correct object for failed status', () => {
const status = CoinifyService.kycBodyHelper('failed')
expect(status.text.props.defaultMessage).toEqual('Your identity verification has failed. Please contact support.')
})
it('should return the correct object for cancelled status', () => {
const status = CoinifyService.kycBodyHelper('cancelled')
expect(status.text.props.defaultMessage).toEqual('Your identity verification was cancelled. Please try again.')
})
it('should return the correct object for default', () => {
const status = CoinifyService.kycBodyHelper('unknown')
expect(status.text.props.defaultMessage).toEqual('Your identity verification status could not be determined, please contact support.')
})
})
describe('kycNotificationBodyHelper', () => {
it('should return the correct object for reviewing status', () => {
const status = CoinifyService.kycNotificationBodyHelper('reviewing')
expect(status.text.props.defaultMessage).toEqual('Your request for authentication has been submitted and will be reviewed shortly. Coinify will email you a status updated within 48 business hours. If you have any questions about the status of your submission, feel free to reach out to Coinify directly at www.coinify.com/support')
})
it('should return the correct object for processing status', () => {
const status = CoinifyService.kycNotificationBodyHelper('processing')
expect(status.text.props.defaultMessage).toEqual('Your request for authentication has been submitted and will be reviewed shortly. Coinify will email you a status updated within 48 business hours. If you have any questions about the status of your submission, feel free to reach out to Coinify directly at www.coinify.com/support')
})
it('should return the correct object for pending status', () => {
const status = CoinifyService.kycNotificationBodyHelper('pending')
expect(status.text.props.defaultMessage).toEqual("It looks like you started your identity verification but didn't finish. Complete this process to link your bank account and/or increase your buy & sell limits.")
})
it('should return the correct object for completed status', () => {
const status = CoinifyService.kycNotificationBodyHelper('completed')
expect(status.text.props.defaultMessage).toEqual('Your identity verification is complete! Your limits have been raised.')
})
it('should return the correct object for rejected status', () => {
const status = CoinifyService.kycNotificationBodyHelper('rejected')
expect(status.text.props.defaultMessage).toEqual('There was an issue verifying your identity with the documents provided. Please try uploading different identification. Bank transfers are unavailable until we can successfully verify your identity.')
})
it('should return the correct object for failed status', () => {
const status = CoinifyService.kycNotificationBodyHelper('failed')
expect(status.text.props.defaultMessage).toEqual('Your identity verification has failed. Please contact support.')
})
it('should return the correct object for cancelled status', () => {
const status = CoinifyService.kycNotificationBodyHelper('cancelled')
expect(status.text.props.defaultMessage).toEqual('Your identity verification was cancelled. Please try again.')
})
it('should return the correct object for expired status', () => {
const status = CoinifyService.kycNotificationBodyHelper('expired')
expect(status.text.props.defaultMessage).toEqual('Your identity verification request has expired. Please try again.')
})
it('should return the correct object for default', () => {
const status = CoinifyService.kycNotificationBodyHelper('unknown')
expect(status.text.props.defaultMessage).toEqual('Unknown')
})
})
describe('checkoutButtonLimitsHelper', () => {
it('should return false', () => {
const result = CoinifyService.checkoutButtonLimitsHelper(Remote.of(baseFiatQuote), correctLimits, 'buy')
expect(result).toEqual(false)
})
it('should return false for a baseBtc quote', () => {
const result = CoinifyService.checkoutButtonLimitsHelper(Remote.of(baseBtcQuote), correctLimits, 'buy')
expect(result).toEqual(false)
})
})
})

0 comments on commit 6a4fc13

Please sign in to comment.