@@ -10,8 +10,8 @@ describe('mapSearchResponse', () => {
1010 response = mapSearchResponse ( camelCaseObject ( mockedResponse ) ) ;
1111 } ) ;
1212
13- it ( 'should match snapshot ' , ( ) => {
14- expect ( response ) . toMatchSnapshot ( ) ;
13+ it ( 'should match number of results ' , ( ) => {
14+ expect ( response . results . length ) . toBe ( mockedResponse . results . length ) ;
1515 } ) ;
1616
1717 it ( 'should match expected filters' , ( ) => {
@@ -24,6 +24,25 @@ describe('mapSearchResponse', () => {
2424 ] ;
2525 expect ( response . filters ) . toEqual ( expectedFilters ) ;
2626 } ) ;
27+
28+ it ( 'should match expected results' , ( ) => {
29+ const mockFirstResult = mockedResponse . results [ 0 ] ;
30+ const expectedFirstResult = {
31+ id : mockFirstResult . data . id ,
32+ title : mockFirstResult . data . content . display_name ,
33+ type : mockFirstResult . data . content_type . toLowerCase ( ) ,
34+ location : mockFirstResult . data . location ,
35+ url : mockFirstResult . data . url ,
36+ contentHits : 0 ,
37+ score : mockFirstResult . score ,
38+ } ;
39+ expect ( response . results [ 0 ] ) . toEqual ( expectedFirstResult ) ;
40+ } ) ;
41+
42+ it ( 'should match expected ms and max score' , ( ) => {
43+ expect ( response . maxScore ) . toBe ( mockedResponse . max_score ) ;
44+ expect ( response . ms ) . toBe ( mockedResponse . took ) ;
45+ } ) ;
2746 } ) ;
2847
2948 describe ( 'when the a keyword is provided' , ( ) => {
0 commit comments