@@ -59,7 +59,7 @@ describe('DevfileRegistries, selectors', () => {
5959 displayName : 'Devfile 2' ,
6060 description : 'Description 2' ,
6161 links : { v2 : 'https://registry2.com/devfile2' } ,
62- tags : [ 'Empty' ] ,
62+ tags : [ 'tag2' , ' Empty'] ,
6363 } as che . DevfileMetaData ,
6464 ] ,
6565 error : 'Error message' ,
@@ -105,7 +105,7 @@ describe('DevfileRegistries, selectors', () => {
105105 displayName : 'Devfile 2' ,
106106 description : 'Description 2' ,
107107 links : { v2 : 'https://registry2.com/devfile2' } ,
108- tags : [ 'Empty' ] ,
108+ tags : [ 'tag2' , ' Empty'] ,
109109 registry : 'https://registry2.com' ,
110110 } ,
111111 ] ) ;
@@ -132,8 +132,11 @@ describe('DevfileRegistries, selectors', () => {
132132 } ) ;
133133
134134 describe ( 'selectMetadataFiltered' , ( ) => {
135- it ( 'should select metadata filtered by filter value' , ( ) => {
135+ it ( 'should select metadata filtered by filter value by displayName' , ( ) => {
136+ mockState . devfileRegistries . filter = 'Devfile 1' ;
137+
136138 const result = selectMetadataFiltered ( mockState ) ;
139+
137140 expect ( result ) . toEqual ( [
138141 {
139142 displayName : 'Devfile 1' ,
@@ -145,6 +148,54 @@ describe('DevfileRegistries, selectors', () => {
145148 ] ) ;
146149 } ) ;
147150
151+ it ( 'should select metadata filtered by filter value by description' , ( ) => {
152+ mockState . devfileRegistries . filter = 'Description 1' ;
153+
154+ const result = selectMetadataFiltered ( mockState ) ;
155+
156+ expect ( result ) . toEqual ( [
157+ {
158+ displayName : 'Devfile 1' ,
159+ description : 'Description 1' ,
160+ links : { v2 : 'https://registry1.com/devfile1' } ,
161+ tags : [ 'tag1' ] ,
162+ registry : 'https://registry1.com' ,
163+ } ,
164+ ] ) ;
165+ } ) ;
166+
167+ it ( 'should select metadata filtered by filter value by tags' , ( ) => {
168+ mockState . devfileRegistries . filter = 'Empty' ;
169+
170+ const result = selectMetadataFiltered ( mockState ) ;
171+
172+ expect ( result ) . toEqual ( [
173+ {
174+ displayName : 'Devfile 2' ,
175+ description : 'Description 2' ,
176+ links : { v2 : 'https://registry2.com/devfile2' } ,
177+ tags : [ 'tag2' , 'Empty' ] ,
178+ registry : 'https://registry2.com' ,
179+ } ,
180+ ] ) ;
181+ } ) ;
182+
183+ it ( 'should select metadata filtered by filter value by link' , ( ) => {
184+ mockState . devfileRegistries . filter = 'registry2.com' ;
185+
186+ const result = selectMetadataFiltered ( mockState ) ;
187+
188+ expect ( result ) . toEqual ( [
189+ {
190+ displayName : 'Devfile 2' ,
191+ description : 'Description 2' ,
192+ links : { v2 : 'https://registry2.com/devfile2' } ,
193+ tags : [ 'tag2' , 'Empty' ] ,
194+ registry : 'https://registry2.com' ,
195+ } ,
196+ ] ) ;
197+ } ) ;
198+
148199 it ( 'should select all metadata if filter value is empty' , ( ) => {
149200 const mockStateWithoutFilterValue = {
150201 ...mockState ,
@@ -167,7 +218,7 @@ describe('DevfileRegistries, selectors', () => {
167218 displayName : 'Devfile 2' ,
168219 description : 'Description 2' ,
169220 links : { v2 : 'https://registry2.com/devfile2' } ,
170- tags : [ 'Empty' ] ,
221+ tags : [ 'tag2' , ' Empty'] ,
171222 registry : 'https://registry2.com' ,
172223 } ,
173224 ] ) ;
0 commit comments