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

Nowe Automaty Do Gier ️ Zagraj W Vulkan Vegas

Nowe Automaty Do Gier ️ Zagraj W Vulkan Vegas” Vulkanvegas: Jakość, Bezpieczeństwo, Szeroki Wybór Gier I Bonusów Content Tome Of Madness Co Jeszcze Powinieneś Wiedzieć Mhh Temat Wypłat Z Vulkan Vegas Kryptowaluty Dostępne W Vulkan Vegas Gry Karciane Oferowane Przez Nasze Kasyno Online Rejestracja I Weryfikacja Bukmachera Vulkan Vegas Dostawcy Gier Zalety We Wady Vulkan …

Nowe Automaty Do Gier ️ Zagraj W Vulkan Vegas Read More »

Сравнение Онлайн Казино выберет Лучший Сайт судя Рейтингу И Условия

Сравнение Онлайн Казино выберет Лучший Сайт судя Рейтингу И Условиям Лучшие Онлайн Казино 2024 ⭐топ Казино На Деньги спасась Casino Online Content Казино пиппардом Минимальным Депозитом Анализируем Ситуацию киромарусом Выплатами Реальных наличных Jet Casino “рейтинг Лучших Онлайн Казино В 2024 году Безопасность а Надежность Платформы Casino-x Выбор Игр личные Сайты Интернет-казино Методы Депозита Игры С …

Сравнение Онлайн Казино выберет Лучший Сайт судя Рейтингу И Условия Read More »

Wöchentlicher Bonus Im Vulkan Vegas Casin

Wöchentlicher Bonus Im Vulkan Vegas Casino Vulkan Vegas 500 Bonus Code » Ohne Einzahlung + 50 Free Spins Content Verwenden Sie Bislang Heute Einen Vulkan Vegas Promo Program Code! Freispiele Ohne Einzahlung “vulkan Vegas Bonus Signal 2024 Das Spielangebote Und Expire Softwareanbieter Im Vulkan Vegas Casino Unser Testergebnis Zum Vulkan Vegas Bonus: 6, 5 Von …

Wöchentlicher Bonus Im Vulkan Vegas Casin Read More »

Best Online Casinos Within Australia For Large Wins 2024 Updat

Best Online Casinos Within Australia For Large Wins 2024 Update Online Casino Web Sites In Australia September 2024 Content Crypto Online Casino Australia What Is A New Reload Bonus? Online Gambling Establishment Bonuses No Deposit Casinos Versus Minimum Deposit Payment Methods Tailored For Aussie Players Best Australian On-line Casinos ( Banking Made Easy Mobile Bonuses …

Best Online Casinos Within Australia For Large Wins 2024 Updat Read More »

Рейтинг самых Онлайн-казино 2024 Топ 10 Честных же Проверенных Казино из 39

Рейтинг самых Онлайн-казино 2024 Топ 10 Честных же Проверенных Казино из 392 Топ подробную Лучших Онлайн Казино ⭐ Рейтинг вопреки Выплатам%2C Отзывам а Отдаче Content отзыв Игроков О Казино Play Fortuna Casino Настольные Игры%2C Лотереи И Видео-покер На Деньги Как мы Оцениваем Сайты ддя Составления Топ Онлайн Казино Проверенные Онлайн Казино С Выводом наличных 1go …

Рейтинг самых Онлайн-казино 2024 Топ 10 Честных же Проверенных Казино из 39 Read More »

Лучшие Онлайн Казино 2024 Топ Казино Для Игры на Деньг

Лучшие Онлайн Казино 2024 Топ Казино Для Игры на Деньги Рейтинг Онлайн Казино Лучшие а Проверенные Заведения же 2024 Году а Реальные Деньги%2C Обзор Топ Брендов Content Настольные Игры%2C Лотереи И Видео-покер на Деньги Бонусная Политика Онлайн Казино кто Нужны Обзоры Интернет-казино В 2024 году%3F Lex Casino возможностей Нашего Рейтинга Можно Ли слепо Любым Рейтингам …

Лучшие Онлайн Казино 2024 Топ Казино Для Игры на Деньг Read More »

“mostbet Oyun Hesabınıza Login Yapmanın Yollar

“mostbet Oyun Hesabınıza Login Yapmanın Yolları Türkiye’nin En İyi Bahis Şirketi Ve Online Casino Content Mostbet’te Promosyon Kodlarını Kullanma Mostbet Mobil Uygulaması Kumarhane Oyunları Destek Hizmeti” Mostbet Türkiye On The Internet Casino Mostbet Bonusları Empieza Promosyon Kodları 💳 Hesabıma Nasıl Para Yükleyebilirim? Mostbet Uygulamasının Bonusunu Nasıl Kullanabilirim? Mostbet’e Kayıt Mostbet Para Yatırma Ve Çekme Mostbet …

“mostbet Oyun Hesabınıza Login Yapmanın Yollar Read More »

1xbet: Türkiye’nin En Güvenilir Canlı Bahis Sitesi 1xbet Giri

1xbet: Türkiye’nin En Güvenilir Canlı Bahis Sitesi 1xbet Giriş Bamgiris Jojobetgiris: Jojobet Güncel Giriş Jojobet Casino & Bahis Giriş 2024″ Content Mostbet Online’da Try (tl) Oynamak Mümkün Mü? Mostbet İlk Üyelik Bonusu Top Sites Spor Bahisleri – Canlı Bahis Mostbet Para Çekme Yöntemleri Mobil Uygulama Ile Pin Up Casinoyu Android Ve Iphone’da Oynayabilirsiniz Pin Upwards …

1xbet: Türkiye’nin En Güvenilir Canlı Bahis Sitesi 1xbet Giri Read More »

Télécharger 1xbet Apk Et L’installer Sur Android Et Iphone 2024

Télécharger 1xbet Apk Et L’installer Sur Android Et Iphone 2024″ 1xbet Apk Août 2024 Télécharger 1xbet Sénégal Apk Content Enregistrement Du Numéro De Téléphone Enjoy Welcome Bonuses Installation De L’application Sur Des Appareils Ios Jeux En Ligne Populaires En Allant Sur L’application 1xbet Apk Puis-je Regarder Un Événement En Direct Et Parier Durante Même Temps ?” …

Télécharger 1xbet Apk Et L’installer Sur Android Et Iphone 2024 Read More »

الشحن و السحب من حساب 1xbet و Melbet، المراهنات الرياضي

الشحن و السحب من حساب 1xbet و Melbet، المراهنات الرياضية “1xbet تحميل 󾔥 تطبيق مجاني على Ios و Android Apk Content Bet للـ Android — كيفية تنزيل التطبيق استراتيجية سرية في لعبة كراش 1xbet لتوقع نتيجة كراش وربح $ يومياً الربح من الأنترنت 🤑 (40 طريقة) بدون رأس مال وخبرة للمبتدئين 2024 النتائج المباشرة في تطبيق …

الشحن و السحب من حساب 1xbet و Melbet، المراهنات الرياضي Read More »

Scroll to Top