/** * External dependencies */ import TestRenderer from 'react-test-renderer'; /** * Internal dependencies */ import withCategory from '../with-category'; import * as mockUtils from '../../components/utils'; import * as mockBaseUtils from '../../base/utils/errors'; jest.mock( '../../components/utils', () => ( { getCategory: jest.fn(), } ) ); jest.mock( '../../base/utils/errors', () => ( { formatError: jest.fn(), } ) ); const mockCategory = { name: 'Clothing' }; const attributes = { categoryId: 1 }; const TestComponent = withCategory( ( props ) => { return (
); } ); const render = () => { return TestRenderer.create( ); }; describe( 'withCategory Component', () => { let renderer; afterEach( () => { mockUtils.getCategory.mockReset(); } ); describe( 'lifecycle events', () => { beforeEach( () => { mockUtils.getCategory.mockImplementation( () => Promise.resolve() ); renderer = render(); } ); it( 'getCategory is called on mount with passed in category id', () => { const { getCategory } = mockUtils; expect( getCategory ).toHaveBeenCalledWith( attributes.categoryId ); expect( getCategory ).toHaveBeenCalledTimes( 1 ); } ); it( 'getCategory is called on component update', () => { const { getCategory } = mockUtils; const newAttributes = { ...attributes, categoryId: 2 }; renderer.update( ); expect( getCategory ).toHaveBeenNthCalledWith( 2, newAttributes.categoryId ); expect( getCategory ).toHaveBeenCalledTimes( 2 ); } ); it( 'getCategory is hooked to the prop', () => { const { getCategory } = mockUtils; const props = renderer.root.findByType( 'div' ).props; props.getCategory(); expect( getCategory ).toHaveBeenCalledTimes( 2 ); } ); } ); describe( 'when the API returns category data', () => { beforeEach( () => { mockUtils.getCategory.mockImplementation( ( categoryId ) => Promise.resolve( { ...mockCategory, id: categoryId } ) ); renderer = render(); } ); it( 'sets the category props', () => { const props = renderer.root.findByType( 'div' ).props; expect( props.error ).toBeNull(); expect( typeof props.getCategory ).toBe( 'function' ); expect( props.isLoading ).toBe( false ); expect( props.category ).toEqual( { ...mockCategory, id: attributes.categoryId, } ); } ); } ); describe( 'when the API returns an error', () => { const error = { message: 'There was an error.' }; const getCategoryPromise = Promise.reject( error ); const formattedError = { message: 'There was an error.', type: 'api' }; beforeEach( () => { mockUtils.getCategory.mockImplementation( () => getCategoryPromise ); mockBaseUtils.formatError.mockImplementation( () => formattedError ); renderer = render(); } ); it( 'sets the error prop', ( done ) => { const { formatError } = mockBaseUtils; getCategoryPromise.catch( () => { const props = renderer.root.findByType( 'div' ).props; expect( formatError ).toHaveBeenCalledWith( error ); expect( formatError ).toHaveBeenCalledTimes( 1 ); expect( props.error ).toEqual( formattedError ); expect( typeof props.getCategory ).toBe( 'function' ); expect( props.isLoading ).toBe( false ); expect( props.category ).toBeNull(); done(); } ); } ); } ); } ); Fantasy Team ( IPL 2023 ) – Page 2 – HOW TO CRIC

Fantasy Team ( IPL 2023 )

GT vs RR Dream 11 Team Prediction Today: Who will Win Today’s IPL Match, IPL 2023-Match 23

IPL 2023: GT vs RR Dream11 Team Prediction Today, Match 23, आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज पर बने रह सकते हैं| क्योंकि मैं GTओर RR आपको की कुछ ऐसे महत्वपूर्ण बातें बताऊंगा| जिससे कि आप dream11 पर एक बेहतरीन टीम तैयार कर सकें| तो …

GT vs RR Dream 11 Team Prediction Today: Who will Win Today’s IPL Match, IPL 2023-Match 23 Read More »

LKN vs PBKS Dream 11 Team Prediction Today: Who will Win Today’s IPL Match 21

IPL 2023: LKN vs PBKS Dream11 Team Prediction Today, Match 21, आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज पर बने रह सकते हैं| क्योंकि मैं LKN ओर PBKS आपको की कुछ ऐसे महत्वपूर्ण बातें बताऊंगा| जिससे कि आप dream11 पर एक बेहतरीन टीम तैयार कर सकें| …

LKN vs PBKS Dream 11 Team Prediction Today: Who will Win Today’s IPL Match 21 Read More »

IPL 2023-Match 22, MI vs KKR Dream 11 Team Prediction Today: Who will Win Today’s IPL Match

IPL 2023: MI vs KKR Dream11 Team Prediction Today, Match 22, आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज पर बने रह सकते हैं| क्योंकि मैं MI ओर KKR आपको की कुछ ऐसे महत्वपूर्ण बातें बताऊंगा| जिससे कि आप dream11 पर एक बेहतरीन टीम तैयार कर सकें| …

IPL 2023-Match 22, MI vs KKR Dream 11 Team Prediction Today: Who will Win Today’s IPL Match Read More »

KKR vs SRH Dream 11 Team Prediction Today, IPL 2023 Match 19

इंडियन प्रीमियर लीग (IPL) 2023 के पहले मैच में Sunrisers Hyderabad का मुकाबला kolkata knight Riders से होगा| kolkata के Eden Gardens में इस मुकाबले की मेजबानी करेगा IPL 2023, KKR vs SRH Dream 11 Team Prediction: KKR vs SRH कि टीमें IPL 2023 के 19वे मैच में आमने-सामने मुकाबला करने के लिए तैयार है| …

KKR vs SRH Dream 11 Team Prediction Today, IPL 2023 Match 19 Read More »

Dream11 New feature Coming: Dream11 मे First Rank लानें का सबसे आसान तरीका, इस तरीके से बनाये टीम

Dream11 New feature Coming: Dream11 मे First Rank लानें का सबसे आसान तरीका, इस तरीके से बनाये टीम आज के article मे हम इसी topic पर बात करेगे Dream11 में नया Backup Feature कैसे काम करता है? आज का आर्टिकल में हम इस बात पर चर्चा करेंगे| हम आपको पूरी जानकारी देंगे आप किस प्रकार …

Dream11 New feature Coming: Dream11 मे First Rank लानें का सबसे आसान तरीका, इस तरीके से बनाये टीम Read More »

Dream11 New Backup Feature | What is Dream11 New Backup Feature, Dream11 New Feature update

Dream11 में नया Backup Feature कैसे काम करता है? आज का आर्टिकल में हम इस बात पर चर्चा करेंगे| हम आपको पूरी जानकारी देंगे आप किस प्रकार dream11 में जो new Feature ऐड हुआ है| आप इसका इस्तेमाल किस प्रकार कर सकते हैं| क्रिकेट फैंस के लिए बहुत बड़ी खुशखबरी आई है| आजकल सभी ने …

Dream11 New Backup Feature | What is Dream11 New Backup Feature, Dream11 New Feature update Read More »

GT vs KKR Dream 11 Team Prediction Today: GT vs KKR Fantasy Cricket Tips, Playing 11, GT vs KKR Pitch Report, Dream11 Team Captain and Vice Captain And Best winning team of today’s match

इंडियन प्रीमियर लीग (IPL) 2023 के पहले मैच में Gujrat Titans का मुकाबला Kolkata Knight Riders से होगा| अहमदाबाद के Narendra Modi Stadium में इस मुकाबले की मेजबानी करेगा| IPL 2023: GT vs KKR Dream11 Team Prediction Match 13, आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज …

GT vs KKR Dream 11 Team Prediction Today: GT vs KKR Fantasy Cricket Tips, Playing 11, GT vs KKR Pitch Report, Dream11 Team Captain and Vice Captain And Best winning team of today’s match Read More »

RR vs DC Dream 11 Team Prediction Today

IPL 2023: RR vs DC Dream11 Team Prediction Today, Match 11, आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज पर बने रह सकते हैं| क्योंकि मैं RR ओर DC आपको की कुछ ऐसे महत्वपूर्ण बातें बताऊंगा| जिससे कि आप dream11 पर एक बेहतरीन टीम तैयार कर सकें| …

RR vs DC Dream 11 Team Prediction Today Read More »

LSG vs SRH Dream 11 Team Prediction Today

IPL 2023: LSG vs SRH Dream11 Team Prediction आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज पर बने रह सकते हैं| क्योंकि मैं LSG ओर SRH आपको की कुछ ऐसे महत्वपूर्ण बातें बताऊंगा| जिससे कि आप dream11 पर एक बेहतरीन टीम तैयार कर सकें| तो चलिए चलते …

LSG vs SRH Dream 11 Team Prediction Today Read More »

KKR vs RCB Dream 11 Team Prediction Today

IPL 2023: KKR vs RCB Dream 11 Team Prediction Today, Match 9, आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज पर बने रह सकते हैं| क्योंकि मैं KKR vs RCB आपको की कुछ ऐसे महत्वपूर्ण बातें बताऊंगा| जिससे कि आप dream11 पर एक बेहतरीन टीम तैयार कर …

KKR vs RCB Dream 11 Team Prediction Today Read More »

Scroll to Top