11import React from 'react'
22import { mount } from 'enzyme'
3+ import SearchProvider from 'react-storefront/search/SearchProvider'
34import SearchSuggestionItem from 'react-storefront/search/SearchSuggestionItem'
45import Image from 'react-storefront/Image'
56import PWAContext from 'react-storefront/PWAContext'
@@ -14,9 +15,11 @@ describe('SearchSuggestionItem', () => {
1415 it ( 'should render children when provided' , ( ) => {
1516 wrapper = mount (
1617 < PWAContext . Provider value = { { hydrating : false } } >
17- < SearchSuggestionItem item = { { href : '/test' } } >
18- < div id = "child" > child</ div >
19- </ SearchSuggestionItem >
18+ < SearchProvider >
19+ < SearchSuggestionItem item = { { href : '/test' } } >
20+ < div id = "child" > child</ div >
21+ </ SearchSuggestionItem >
22+ </ SearchProvider >
2023 </ PWAContext . Provider > ,
2124 )
2225
@@ -26,7 +29,9 @@ describe('SearchSuggestionItem', () => {
2629 it ( 'should render image with a text when no children provided' , ( ) => {
2730 wrapper = mount (
2831 < PWAContext . Provider value = { { hydrating : false } } >
29- < SearchSuggestionItem item = { { href : '/test' , text : 'test' } } />
32+ < SearchProvider >
33+ < SearchSuggestionItem item = { { href : '/test' , text : 'test' } } />
34+ </ SearchProvider >
3035 </ PWAContext . Provider > ,
3136 )
3237
@@ -42,10 +47,12 @@ describe('SearchSuggestionItem', () => {
4247 it ( 'should spread thumbnail props on image' , ( ) => {
4348 wrapper = mount (
4449 < PWAContext . Provider value = { { hydrating : false } } >
45- < SearchSuggestionItem
46- item = { { href : '/test' , thumbnail : { testprop2 : 'test2' } } }
47- thumbnailProps = { { testprop1 : 'test1' } }
48- />
50+ < SearchProvider >
51+ < SearchSuggestionItem
52+ item = { { href : '/test' , thumbnail : { testprop2 : 'test2' } } }
53+ thumbnailProps = { { testprop1 : 'test1' } }
54+ />
55+ </ SearchProvider >
4956 </ PWAContext . Provider > ,
5057 )
5158
0 commit comments