/** * 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(); } ); } ); } ); } ); CRICKET – Page 2 – HOW TO CRIC

CRICKET

IPL 2023: गुजरात टाइटंस के लिए चौका देने वाली खबर यह कौन सा खिलाड़ी है, जो गुजरात टाइटंस का साथ नहीं दे पाया

IPL 2023 से डिफेंडिंग चैंपियन गुजरात टाइटंस (GT) को सीजन के बीच में एक बहुत बड़ा झटका लगने वाला है| एक खिलाड़ी जो गुजरात टाइटंस का आधे सीजन में साथ छोड़ने के लिए तैयार हो चुका है और वह अपने देश वापस लौटना चाहता है IPL 2023 में गुजरात टाइटंस (GT) खिताब अपने नाम करने …

IPL 2023: गुजरात टाइटंस के लिए चौका देने वाली खबर यह कौन सा खिलाड़ी है, जो गुजरात टाइटंस का साथ नहीं दे पाया Read More »

IPL 2023 MI vs PBKS: मुंबई इंडियंस के फैंस ने किया यह कारनामा फैंस ने किये दो अनोखे रेकॉर्ड अपने नाम

IPL 2023 मुंबई इंडियंस और पंजाब किंग्स का मैच 22 अप्रैल को अगला मुकाबला वानखेड़े स्टेडियम में खेला जाएगा, तो तैयार हो जाइए मुंबई इंडियंस (MI) vs पंजाब किंग्स (PBKS) के मुकाबले के लिए इंडियन प्रीमियर लीग (IPL) फ्रेंचाइजी मुंबई इंडियंस (MI) का बहुत बड़ा फैन है और उन्ही प्रशंसकों में से एक फैन ने …

IPL 2023 MI vs PBKS: मुंबई इंडियंस के फैंस ने किया यह कारनामा फैंस ने किये दो अनोखे रेकॉर्ड अपने नाम Read More »

RCB vs RR Dream 11 Team Prediction Today, Fantasy Cricket Tips, Playing 11, Pitch Report, Dream11 Team Captain and Vice Captain And Best winning team of today’s match, IPL 2023

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

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

MI vs PBKS Dream 11 Team Prediction Today, Fantasy Cricket Tips, Playing 11, Pitch Report, Dream11 Team Captain and Vice Captain And Best winning team of today’s match, IPL 2023

Who will Win Today’s IPL Match-MI vs PBKS MI vs PBKS Dream 11 Team Prediction, आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज पर बने रह सकते हैं| क्योंकि मैं MI और PBKS आपको की कुछ ऐसे महत्वपूर्ण बातें बताऊंगा| जिससे कि आप dream11 पर एक बेहतरीन …

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

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

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

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

CSK vs SRH Dream 11 Team Prediction Today: Who will Win Today’s IPL Match

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

CSK vs SRH Dream 11 Team Prediction Today: Who will Win Today’s IPL Match Read More »

PBKS vs RCB Dream 11 Team Prediction Today: Who will Win Today’s IPL Match – IPL 2023

Fafduplessis is the Orange Cap HolderWho will Win Today’s IPL Match- PBKS vs RCB PBKS vs RCB Dream11 Team Prediction आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज पर बने रह सकते हैं| क्योंकि मैं PBKS ओर RCB आपको की कुछ ऐसे महत्वपूर्ण बातें बताऊंगा| जिससे कि …

PBKS vs RCB Dream 11 Team Prediction Today: Who will Win Today’s IPL Match – IPL 2023 Read More »

Match 25, SRH vs MI Dream 11 Team Prediction Today: Who will Win Today’s IPL Match – IPL 2023

Who will Win Today’s IPL Match- SRH vs MI आज होने वाले IPL मैच में कौन जीतेगा? यह जानने के लिए आप इस आर्टिकल पेज पर बने रह सकते हैं| क्योंकि मैं SRH ओर MI आपको की कुछ ऐसे महत्वपूर्ण बातें बताऊंगा| जिससे कि आप dream11 पर एक बेहतरीन टीम तैयार कर सकें| तो चलिए …

Match 25, SRH vs MI Dream 11 Team Prediction Today: Who will Win Today’s IPL Match – IPL 2023 Read More »

RCB vs CSK Dream 11 Team Prediction Today: Who will Win Today’s IPL Match – IPL 2023

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

RCB vs CSK Dream 11 Team Prediction Today: Who will Win Today’s IPL Match – IPL 2023 Read More »

Bhuvneshwar kumar ने IPL में बनाया New Record: भारत के पहले तेज गेंदबाज ने यह कर दिखाया कारनामा

Bhuvneshwar kumar ने अपना 150वां IPL मैच खेला सनराइजर्स हैदराबाद (SRH) के तेज गेंदबाज भुवनेश्वर कुमार ने शुक्रवार को कोलकाता नाइट राइडर्स (KKR) के खिलाफ मैच में ऐसा प्रदर्शन किया, की एक खास रिकॉर्ड अपने नाम कर लिया है| भुवनेश्वर कुमार भारत के पहले तेज गेंदबाज खिलाड़ी बन चुके हैं| सनराइजर्स हैदराबाद के तेज गेंदबाज …

Bhuvneshwar kumar ने IPL में बनाया New Record: भारत के पहले तेज गेंदबाज ने यह कर दिखाया कारनामा Read More »

Scroll to Top