@@ -81,6 +81,7 @@ describe('TypeormStakePoolProvider', () => {
81
81
let filterArgs : QueryStakePoolsArgs ;
82
82
let poolsInfo : PoolInfo [ ] ;
83
83
let poolsInfoWithMeta : PoolInfo [ ] ;
84
+ let poolsInfoWithUniqueMeta : PoolInfo [ ] ;
84
85
let poolsInfoWithMetaFiltered : PoolInfo [ ] ;
85
86
let poolsInfoWithMetrics : PoolInfo [ ] ;
86
87
let poolsInfoWithMetricsFiltered : PoolInfo [ ] ;
@@ -108,15 +109,18 @@ describe('TypeormStakePoolProvider', () => {
108
109
poolsInfo = await fixtureBuilder . getPools ( 1000 , [ 'active' , 'activating' , 'retired' , 'retiring' ] ) ;
109
110
poolsInfoWithMeta = poolsInfo . filter ( ( pool ) => isNotNil ( pool . metadataUrl ) ) ;
110
111
poolsInfoWithMetrics = poolsInfo . filter ( ( pool ) => isNotNil ( pool . saturation ) ) ;
112
+ poolsInfoWithUniqueMeta = poolsInfoWithMeta
113
+ . filter ( ( { name, ticker } ) => name !== 'Same Name' && ticker !== 'SP6a7' )
114
+ . sort ( ( a , b ) => ( a . name < b . name ? - 1 : 1 ) ) ;
111
115
112
116
filterArgs = {
113
117
filters : {
114
118
identifier : {
115
119
_condition : 'or' ,
116
120
values : [
117
- { ticker : poolsInfoWithMeta [ 0 ] . ticker } ,
118
- { name : poolsInfoWithMeta [ 1 ] . name } ,
119
- { id : poolsInfoWithMeta [ 2 ] . id }
121
+ { ticker : poolsInfoWithUniqueMeta [ 0 ] . ticker } ,
122
+ { name : poolsInfoWithUniqueMeta [ 1 ] . name } ,
123
+ { id : poolsInfoWithUniqueMeta [ 2 ] . id }
120
124
]
121
125
}
122
126
} ,
@@ -625,7 +629,7 @@ describe('TypeormStakePoolProvider', () => {
625
629
describe ( 'by default, result is sorted by relevance' , ( ) => {
626
630
it ( 'with stringent search' , async ( ) => {
627
631
const response = await provider . queryStakePools ( { filters : { text : 'sp11' } , pagination } ) ;
628
- expect ( response . pageResults . map ( ( { metadata } ) => metadata ?. ticker ) ) . toEqual ( [ 'SP11' , 'SP1 ' , 'SP10 ' ] ) ;
632
+ expect ( response . pageResults . map ( ( { metadata } ) => metadata ?. ticker ) ) . toEqual ( [ 'SP11' , 'SP10 ' , 'SP1 ' ] ) ;
629
633
} ) ;
630
634
631
635
it ( 'with mild search' , async ( ) => {
@@ -739,7 +743,7 @@ describe('TypeormStakePoolProvider', () => {
739
743
const response = await provider . queryStakePools (
740
744
setSortCondition ( setFilterCondition ( filterArgs , 'or' ) , 'asc' , 'ticker' )
741
745
) ;
742
- const expected = [ ...poolsInfoWithMeta ] . sort ( ( a , b ) => ( a . ticker < b . ticker ? - 1 : 1 ) ) ;
746
+ const expected = [ ...poolsInfoWithMetricsFiltered ] . sort ( ( a , b ) => ( a . ticker < b . ticker ? - 1 : 1 ) ) ;
743
747
expect ( response . pageResults [ 0 ] . metadata ?. ticker ) . toEqual ( expected [ 0 ] . ticker ) ;
744
748
expect ( response . pageResults [ 1 ] . metadata ?. ticker ) . toEqual ( expected [ 1 ] . ticker ) ;
745
749
} ) ;
0 commit comments