it('getView should return AddCardSc if it is turned on in OrgSettings', function() { Playtech.Variables.useSafeChargeToken = true; var cashierModel = new CashierModel({ config: { cashierType: 'ADD_PAYMENT_METHOD' } }); cashierModel.getView().should.to.be.instanceof(AddcardScView); });
describe('Cashier model', function() { var cashierModel = new CashierModel({ config: {} }), mapping = [ { cashierType: 'DEPOSIT', view: DepositView }, { cashierType: 'WITHDRAW', view: WithdrawView }, { cashierType: 'TRANSACTION_HISTORY', view: TransactionHistoryView }, { cashierType: 'PENDING_WITHDRAWALS', view: PendingView }, { cashierType: 'ADD_PAYMENT_METHOD', view: AddcardView } ]; mapping.forEach(function(payment) { it('getView method should return correct view, depends on config (' + payment.cashierType + ')', function() { cashierModel.set('config', {cashierType: payment.cashierType}); cashierModel.getView().should.to.be.instanceof(payment.view); }); }); it('getView method should return deposit view by default', function() { cashierModel.set('config', {cashierType: ''}); cashierModel.getView().should.to.be.instanceof(DepositView); }); it('getView should return AddCardSc if it is turned on in OrgSettings', function() { Playtech.Variables.useSafeChargeToken = true; var cashierModel = new CashierModel({ config: { cashierType: 'ADD_PAYMENT_METHOD' } }); cashierModel.getView().should.to.be.instanceof(AddcardScView); }); });
it('getView method should return deposit view by default', function() { cashierModel.set('config', {cashierType: ''}); cashierModel.getView().should.to.be.instanceof(DepositView); });
it('getView method should return correct view, depends on config (' + payment.cashierType + ')', function() { cashierModel.set('config', {cashierType: payment.cashierType}); cashierModel.getView().should.to.be.instanceof(payment.view); });