@@ -23,19 +23,26 @@ const setups: Record<string, OracleSetup> = {
2323 { token : 'TA' , currency : 'USD' } ,
2424 { token : 'TB' , currency : 'USD' } ,
2525 { token : 'TC' , currency : 'USD' } ,
26- { token : 'TD' , currency : 'USD' }
26+ { token : 'TD' , currency : 'USD' } ,
27+ { token : 'TE' , currency : 'USD' } ,
28+ { token : 'TF' , currency : 'USD' }
2729 ] ,
2830 prices : [
2931 [
3032 { tokenAmount : '1.1@TA' , currency : 'USD' } ,
3133 { tokenAmount : '2.1@TB' , currency : 'USD' } ,
3234 { tokenAmount : '3.1@TC' , currency : 'USD' } ,
33- { tokenAmount : '4.1@TD' , currency : 'USD' }
35+ { tokenAmount : '4.1@TD' , currency : 'USD' } ,
36+ { tokenAmount : '5.1@TE' , currency : 'USD' } ,
37+ { tokenAmount : '6.1@TF' , currency : 'USD' }
3438 ] ,
3539 [
3640 { tokenAmount : '1@TA' , currency : 'USD' } ,
3741 { tokenAmount : '2@TB' , currency : 'USD' } ,
38- { tokenAmount : '3@TC' , currency : 'USD' }
42+ { tokenAmount : '3@TC' , currency : 'USD' } ,
43+ { tokenAmount : '4@TD' , currency : 'USD' } ,
44+ { tokenAmount : '5@TE' , currency : 'USD' } ,
45+ { tokenAmount : '6@TF' , currency : 'USD' }
3946 ] ,
4047 [
4148 { tokenAmount : '0.9@TA' , currency : 'USD' } ,
@@ -50,18 +57,21 @@ const setups: Record<string, OracleSetup> = {
5057 feed : [
5158 { token : 'TA' , currency : 'USD' } ,
5259 { token : 'TB' , currency : 'USD' } ,
53- { token : 'TD' , currency : 'USD' }
60+ { token : 'TD' , currency : 'USD' } ,
61+ { token : 'TG' , currency : 'USD' }
5462 ] ,
5563 prices : [
5664 [
5765 { tokenAmount : '1.5@TA' , currency : 'USD' } ,
5866 { tokenAmount : '2.5@TB' , currency : 'USD' } ,
59- { tokenAmount : '4.5@TD' , currency : 'USD' }
67+ { tokenAmount : '4.5@TD' , currency : 'USD' } ,
68+ { tokenAmount : '6.5@TG' , currency : 'USD' }
6069 ] ,
6170 [
6271 { tokenAmount : '1.5@TA' , currency : 'USD' } ,
6372 { tokenAmount : '2.5@TB' , currency : 'USD' } ,
64- { tokenAmount : '4.5@TD' , currency : 'USD' }
73+ { tokenAmount : '4.5@TD' , currency : 'USD' } ,
74+ { tokenAmount : '6.5@TG' , currency : 'USD' }
6575 ]
6676 ]
6777 } ,
@@ -72,13 +82,15 @@ const setups: Record<string, OracleSetup> = {
7282 feed : [
7383 { token : 'TA' , currency : 'USD' } ,
7484 { token : 'TB' , currency : 'USD' } ,
75- { token : 'TC' , currency : 'USD' }
85+ { token : 'TC' , currency : 'USD' } ,
86+ { token : 'TH' , currency : 'USD' }
7687 ] ,
7788 prices : [
7889 [
7990 { tokenAmount : '1.25@TA' , currency : 'USD' } ,
8091 { tokenAmount : '2.25@TB' , currency : 'USD' } ,
81- { tokenAmount : '4.25@TC' , currency : 'USD' }
92+ { tokenAmount : '4.25@TC' , currency : 'USD' } ,
93+ { tokenAmount : '8.25@TH' , currency : 'USD' }
8294 ]
8395 ]
8496 }
@@ -122,7 +134,7 @@ afterAll(async () => {
122134
123135it ( 'should list' , async ( ) => {
124136 const { data : prices } = await controller . list ( )
125- expect ( prices . length ) . toStrictEqual ( 4 )
137+ expect ( prices . length ) . toStrictEqual ( 7 )
126138 expect ( prices [ 0 ] ) . toStrictEqual ( {
127139 id : 'TB-USD' ,
128140 sort : '000000030000006eTB-USD' ,
@@ -139,8 +151,7 @@ it('should list', async () => {
139151 key : 'TB-USD' ,
140152 sort : expect . any ( String ) ,
141153 aggregated : {
142- // amount: '2.30000000',
143- amount : expect . any ( String ) , // 2.33333333
154+ amount : expect . any ( String ) ,
144155 weightage : 3 ,
145156 oracles : {
146157 active : 2 ,
@@ -149,6 +160,21 @@ it('should list', async () => {
149160 }
150161 }
151162 } )
163+
164+ // check order
165+ const expectOrders = [
166+ 'TB-USD' ,
167+ 'TA-USD' ,
168+ 'TC-USD' ,
169+ 'TD-USD' ,
170+ 'TG-USD' ,
171+ 'TF-USD' ,
172+ 'TE-USD'
173+ ]
174+ const ids = prices . map ( p => p . id )
175+ for ( let i = 0 ; i < ids . length ; i += 1 ) {
176+ expect ( ids [ i ] ) . toStrictEqual ( expectOrders [ i ] )
177+ }
152178} )
153179
154180it ( 'should get ticker' , async ( ) => {
0 commit comments