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

Uncategorized

Vulkan Vegas Online Online Casino Jetzt Registrieren Sowie Bonus Sicher

Vulkan Vegas Online Online Casino Jetzt Registrieren Sowie Bonus Sichern Online Casino Österreich 1 500 + 150 Freispiele Content Vulkan Vegas On The Web Casino Welche Angebote Gibt Es Für Highroller” “[newline]gibt Es Einen Added Bonus Ohne Einzahlung? Wie Lange Dauern Vulkan Vegas Auszahlungen? Registrierungsbonus Bei Vulkan Vegas Casino Was Sind Vulkan Vegas Freispiele Unter …

Vulkan Vegas Online Online Casino Jetzt Registrieren Sowie Bonus Sicher Read More »

Migliori Online Casino In Italia Del 2024 Classifica Aggiornata Casinò Legal

Migliori Online Casino In Italia Del 2024 Classifica Aggiornata Casinò Legali Migliori Casinò Online Aams: Tutti I Leading Siti Casinò Italiani 2024 Content I Reward Presenti Sul Casinò Admiralbet Snai Casino Quali Sono Le Differenze Tra I Casinò On The Internet Adm E Quelli Stranieri? Qual È Il Miglior Sito Casinò Del Mese? 🛡️ I …

Migliori Online Casino In Italia Del 2024 Classifica Aggiornata Casinò Legal Read More »

Gamblers To Become Restricted To $100 Limits On Holdem Poker Machines In éxito As Part Of New Reform

Gamblers To Become Restricted To $100 Limits On Holdem Poker Machines In éxito As Part Of New Reforms 10 Best Australian Free Pokies Download Sites 2024 Content How To Set The Bet While Beginning With Online Pokies? Play Pokies Using Optimal Volatility The 3rd Way Up And Coming Game Gamblers To Be Limited To $100 …

Gamblers To Become Restricted To $100 Limits On Holdem Poker Machines In éxito As Part Of New Reform Read More »

The Uks Best Casinos Not Necessarily On Gamstop Inside 202

The Uks Best Casinos Not Necessarily On Gamstop Inside 2024 Non Gamstop Casinos » Uk Casino Not On Gamstop 2024 Content Common Highlights Of Online Bingo Not Necessarily On Gamstop Exploring The Particular Legitimacy Of Non-gamstop Casinos Why United Kingdom Players Like Bingo Sites Not With Gamstop Cons Of Non-gamstop Casinos Pros And Negatives Of …

The Uks Best Casinos Not Necessarily On Gamstop Inside 202 Read More »

Best Casino Welcome Bonus Within Canada 2024

Best Casino Welcome Bonus Within Canada 2024″ Best On-line Casinos Canada 2024 Top Sites For Canadian Players Content Deposit Bonuses What’s New With Ontario Online Casinos How Do Our Experts Rank And Review Online Casinos? Popular On-line Casino Games Within Canada Quick And Reliable Customer Support How To Pick The Best Online Casino Canada Low …

Best Casino Welcome Bonus Within Canada 2024 Read More »

“En İyi Türkiye On The Web Casinolar 2024-top Çevrimiçi Casino Rehber

“En İyi Türkiye On The Web Casinolar 2024-top Çevrimiçi Casino Rehberi Ücretsiz Online Casino Oyunları” Content Top Türk Çevrimdışı Kumarhaneleri Vbet Casino En Güvenilir Türk Online Casinolar Türkiye’de Online Online Casino Düzenlemeleri Bonuslar Sizi Bekliyor Bets10 Gametwist Oyunları Casino’da Iyi Eğlenceler Beceri Oyunları, Poker & Bingo” En Iyi 10 Türk Online Casinoları Slots Online Casino …

“En İyi Türkiye On The Web Casinolar 2024-top Çevrimiçi Casino Rehber Read More »

22bet Casino Gioca Allesamt Slot O Approach Poker Online Con Denar

22bet Casino Gioca Allesamt Slot O Approach Poker Online Con Denaro Accedi Ing Sito Ufficiale Del 22bet Casinò Content Giochi Ag Tavolo Metodi Di Pagamento Elettronici E Con Criptovalute Fantastiche Opzioni Di Casinò Online Casinò 22bet – Are Generally Selezione Delle Position Machine Et App Compatibile Con Android E Ios Recensione Sulle Quote Scommesse Su …

22bet Casino Gioca Allesamt Slot O Approach Poker Online Con Denar Read More »

En İyi Türkiye Online Casinolar 2024-top Çevrimiçi On Line Casino Rehber

En İyi Türkiye Online Casinolar 2024-top Çevrimiçi On Line Casino Rehberi 2024 Adresindeki En İyi Online Casino Sitelerinin Adresleri Uzmanlarımızın Dürüst İncelemesi Content Canlı Casino Siteleri 2024 – Güvenilir Durante” “iyi 10 Site Tipobet Casino Oyun Seçenekleri Sorumluluk Ve Oyun Kontrolü Betivo – Slot” “bonusu Sunan Casino Siteleri Celtabet Casino Bonusları Video Poker Neden Türkiye’deki …

En İyi Türkiye Online Casinolar 2024-top Çevrimiçi On Line Casino Rehber Read More »

Newcasinorank Sitesini Ziyaret Edin Yeni Çevrimiçi Kumarhaneler Hakkında Tam Kılavuz

Newcasinorank Sitesini Ziyaret Edin Yeni Çevrimiçi Kumarhaneler Hakkında Tam Kılavuz” Casino Siteleri 2024 En Iyi Ve En Güvenilir Canlı Online Casinolar Diğer bir sorun ise insanların bilinçsiz kalması ve casino oyunları bir kazanç kapısı olarak görmesidir. Online casino hizmeti veren firmalar Türkiye’de yasal bir hizmet verememektedir. Bundan dolayı de uma casino hizmeti veren yabancı bahis …

Newcasinorank Sitesini Ziyaret Edin Yeni Çevrimiçi Kumarhaneler Hakkında Tam Kılavuz Read More »

Nouveaux Casinos Français En Ligne Sobre 2024 Top Web Sites Avec Bonu

Nouveaux Casinos Français En Ligne Sobre 2024 Top Web Sites Avec Bonus Meilleurs Casinos Sur Internet & Bookmakers Français Added Bonus Exclusifs” Content Flush Casino – Le Plus Concurentiel Casino Sobre Crypto Free Spins Est-il Possible De Jouer Aux Casinos En Ligne En Allant Sur Mobile? Les 3 Meilleurs Casinos En Segment De 2024 Les …

Nouveaux Casinos Français En Ligne Sobre 2024 Top Web Sites Avec Bonu Read More »

Scroll to Top