NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import React from 'react';
import { shallow, mount } from 'enzyme';

import { KeyAccountBalanceContainer } from './KeyAccountBalanceContainer';
import KeyAccountBalanceView from './KeyAccountBalanceView';
import {
getKeyAccountsBalanceMock,
getSelectedAcctTransactionMock
} from '../../api/KeyAccBalApi/mockApi';

jest.mock('../../api/KeyAccBalApi', () => ({
getKeyAccountsBalance: jest.fn(),
getSelectedAcctTransaction: jest.fn()
}));

const mockApi = require('../../api/KeyAccBalApi');

mockApi.getKeyAccountsBalance.mockImplementation(() => {
return Promise.resolve(getKeyAccountsBalanceMock);
});

mockApi.getSelectedAcctTransaction.mockImplementation(() => {
console.log('helllo');
return Promise.resolve(getSelectedAcctTransactionMock);
});

const transaction = {
acctNum: '0101328923',
acctName: 'HAI SENG HENG FISHERY TDG',
bankCode: 'SCBLSG22XXX',
acctBal: '92366.33',
ctryCode: 'SG',
ccyCode: 'SGD',
inFlow: '0',
outFlow: '0',
transactionsList: [
{
transdesc: 'CASH WITHDRAWAL SGD',
transAmt: 20000,
transccyCode: 'SGD',
debitcreditflag: 'D',
transDate: '2016-11-12 20:05:37.0',
transdetaildesc: 'CASH WITHDRAWAL SGD 17 Cash Withdrawal LCY-Debit',
encTransdetaildesc:
'(splt) (splt)(splt) (splt)17(splt) (splt)Cash Withdrawal LCY-Debit'
},
{
transdesc: 'CASH DEPOSIT',
transAmt: 22570,
transccyCode: 'SGD',
debitcreditflag: 'C',
transDate: '2016-11-12 20:04:08.0',
transdetaildesc: 'CASH DEPOSIT 13 Cash Deposit LCY-Credit',
encTransdetaildesc:
'(splt) (splt)(splt) (splt)13(splt) (splt)Cash Deposit LCY-Credit'
},
{
transdesc: 'CLEARING CHEQUE 077235',
transAmt: 4115,
transccyCode: 'SGD',
debitcreditflag: 'D',
transDate: '2016-10-24 21:40:04.0',
transdetaildesc: 'CLEARING CHEQUE 077235 33 Inward Clearing-Debit',
encTransdetaildesc:
'(splt) (splt)(splt) (splt)33(splt) (splt)Inward Clearing-Debit'
},
{
transdesc: 'BULK CHEQUE DEPOSIT (SGD) 300750310',
transAmt: 4114.6,
transccyCode: 'SGD',
debitcreditflag: 'C',
transDate: '2016-10-24 16:02:38.0',
transdetaildesc:
'BULK CHEQUE DEPOSIT (SGD) 300750310 32 Outward Clearing-Credit',
encTransdetaildesc:
'(splt) (splt)(splt) (splt)32(splt) (splt)Outward Clearing-Credit'
}
]
};

describe('<KeyAccountBalanceContainer>', () => {
const apiConfig = 'http://localhost:4201/s2b/global/corporate/api/';
const isMockMode = true;
const noop = () => {};
function shallowKeyAccountContainer(props = {}) {
return shallow(
<KeyAccountBalanceContainer
apiConfig={props.apiConfig || noop}
isMockMode={props.isMockMode}
onUpdated={props.onUpdated || noop}
onUpdating={props.onUpdating || noop}
timeOfWidgetButtonsClick={props.timeOfWidgetButtonsClick}
selectedFilterItemId={props.selectedFilterItemId}
/>
);
}

function mountKeyAccountContainer(props = {}) {
return mount(
<KeyAccountBalanceContainer
apiConfig={props.apiConfig || noop}
isMockMode={props.isMockMode}
onUpdated={props.onUpdated || noop}
onUpdating={props.onUpdating || noop}
timeOfWidgetButtonsClick={props.timeOfWidgetButtonsClick}
selectedFilterItemId={props.selectedFilterItemId}
/>
);
}

it('Should render correctly', () => {
const keyAccountBalanceContainer = shallowKeyAccountContainer({
apiConfig,
isMockMode
});

expect(keyAccountBalanceContainer).toMatchSnapshot();
});
it('Should render correctly', () => {
const keyAccountBalanceContainer = shallowKeyAccountContainer({
apiConfig,
isMockMode
});

expect(keyAccountBalanceContainer).toMatchSnapshot();
});

it('Should display the Key account balance view', () => {
const keyAccountBalanceContainer = shallowKeyAccountContainer({
apiConfig,
isMockMode
});
keyAccountBalanceContainer.setState({
iskeyAccView: true,
isSpinner: false
});
expect(
keyAccountBalanceContainer.find('KeyAccountBalanceView')
).toHaveLength(1);
});
it.only('Should display with onTableScroll as true', () => {
const keyAccountContainer = mountKeyAccountContainer({
apiConfig,
isMockMode
});
//keyAccountContainer.setState({ iskeyAccView: false, isSpinner: false });
keyAccountContainer.setState({
iskeyAccView: true,
isSpinner: false
});
console.log(
keyAccountContainer.find(KeyAccountBalanceView).length,
'length length'
);
keyAccountContainer.find(KeyAccountBalanceView).prop('onItemClick')({
accountNo: '1233',
bankCode: '323343',
countryCode: '2334',
currencyCode: '2131fd'
});
//keyAccountContainer.find(KeyAccountBalanceView).simulate('click');
expect(keyAccountContainer).toMatchSnapshot();
});

it('Should render keyaccbalance detail view snapshot', () => {
const keyAccountBalanceContainer = shallowKeyAccountContainer({
apiConfig,
isMockMode
});
keyAccountBalanceContainer.setState({
accountDetails: transaction,
iskeyAccView: false,
isSpinner: false
});
expect(keyAccountBalanceContainer).toMatchSnapshot();
});
});
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.