@@ -15,10 +15,14 @@ function renderFiltersCard(overrides = {}) {
1515 onRemoveFilter : vi . fn ( ) ,
1616 onClearFilters : vi . fn ( ) ,
1717 keywords : [ "React" ] ,
18- selectedFile : "vagas.xlsx" ,
19- setSelectedFile : vi . fn ( ) ,
20- files : [ { file : "vagas.xlsx" } ] ,
21- meta : { file : "vagas.xlsx" , modifiedAt : Date . now ( ) , total : 1 } ,
18+ meta : {
19+ total : 1 ,
20+ hasNext : false ,
21+ hasPrev : false ,
22+ page : 1 ,
23+ limit : 5 ,
24+ totalPages : 1 ,
25+ } ,
2226 ...overrides ,
2327 } ;
2428
@@ -27,64 +31,54 @@ function renderFiltersCard(overrides = {}) {
2731 return props ;
2832}
2933
30- describe ( "JobsFiltersCard" , ( ) => {
31- it ( "adiciona termo de busca como filtro e permite refresh" , ( ) => {
32- const onRefresh = vi . fn ( ) ;
33- const props = renderFiltersCard ( {
34- actions : (
35- < button type = "button" onClick = { onRefresh } >
36- Atualizar
37- </ button >
38- ) ,
39- } ) ;
34+ describe ( "JobsFiltersCard Extended" , ( ) => {
35+ it ( "adiciona termo de busca como filtro" , ( ) => {
36+ const props = renderFiltersCard ( ) ;
4037
4138 fireEvent . change ( screen . getByPlaceholderText ( / b u s c a r / i) , {
4239 target : { value : "node" } ,
4340 } ) ;
4441 fireEvent . click (
4542 screen . getByRole ( "button" , { name : / a d i c i o n a r f i l t r o d e b u s c a / i } ) ,
4643 ) ;
47- fireEvent . click ( screen . getByRole ( "button" , { name : / a t u a l i z a r / i } ) ) ;
4844
4945 expect ( props . setSearch ) . toHaveBeenCalledTimes ( 1 ) ;
5046 expect ( props . setSearch . mock . calls [ 0 ] [ 0 ] ( "React" ) ) . toBe ( "React, node" ) ;
5147 expect ( screen . getByPlaceholderText ( / b u s c a r / i) ) . toHaveValue ( "" ) ;
52- expect ( onRefresh ) . toHaveBeenCalledTimes ( 1 ) ;
5348 } ) ;
5449
55- it ( "renderiza badge de arquivo, total e area de filtros" , ( ) => {
50+ it ( "renderiza total e area de filtros" , ( ) => {
5651 renderFiltersCard ( ) ;
5752
58- expect ( screen . getAllByText ( / v a g a s \. x l s x / i) . length ) . toBeGreaterThan ( 0 ) ;
5953 expect ( screen . getByText ( / 1 v a g a s / i) ) . toBeInTheDocument ( ) ;
6054 expect ( screen . getByText ( / f i l t r o s s e l e c i o n a d o s / i) ) . toBeInTheDocument ( ) ;
6155 expect ( screen . getByText ( / u s e o b o t ã o f i l t r a r / i) ) . toBeInTheDocument ( ) ;
6256 } ) ;
6357
64- it ( "dispara mudancas nos filtros de keyword e arquivo" , ( ) => {
65- const props = renderFiltersCard ( {
66- files : [ { file : "vagas.xlsx" } , { file : "historico.xlsx" } ] ,
67- meta : { file : "vagas.xlsx" , modifiedAt : Date . now ( ) , total : 2 } ,
68- } ) ;
58+ it ( "dispara mudancas nos filtros de keyword" , ( ) => {
59+ const props = renderFiltersCard ( ) ;
6960
7061 const selects = screen . getAllByRole ( "combobox" ) ;
7162
7263 fireEvent . change ( selects [ 0 ] , {
7364 target : { value : "React" } ,
7465 } ) ;
75- fireEvent . change ( selects [ 1 ] , {
76- target : { value : "historico.xlsx" } ,
77- } ) ;
7866
7967 expect ( props . setKeywordFilter ) . toHaveBeenCalled ( ) ;
80- expect ( props . setSelectedFile ) . toHaveBeenCalled ( ) ;
8168 } ) ;
8269
8370 it ( "abre o gerenciador e aciona limpar/remover filtros selecionados" , ( ) => {
8471 const props = renderFiltersCard ( {
8572 search : "UX/UI Designer" ,
8673 keywordFilter : [ "React" ] ,
87- meta : { file : "vagas.xlsx" , modifiedAt : Date . now ( ) , total : 2 } ,
74+ meta : {
75+ total : 2 ,
76+ hasNext : false ,
77+ hasPrev : false ,
78+ page : 1 ,
79+ limit : 5 ,
80+ totalPages : 1 ,
81+ } ,
8882 } ) ;
8983
9084 fireEvent . click ( screen . getByRole ( "button" , { name : / ^ f i l t r a r $ / i } ) ) ;
0 commit comments