@@ -51,4 +51,67 @@ describe('agentMap (babydegen-ui)', () => {
5151
5252 expect ( ( ) => require ( '../../src/utils/agentMap' ) ) . not . toThrow ( ) ;
5353 } ) ;
54+
55+ describe ( 'normalizeProtocol' , ( ) => {
56+ it ( 'maps velodrome to aerodrome for basius' , ( ) => {
57+ process . env . REACT_APP_AGENT_NAME = 'basius' ;
58+
59+ const { normalizeProtocol } = require ( '../../src/utils/agentMap' ) ;
60+ expect ( normalizeProtocol ( 'velodrome' ) ) . toBe ( 'aerodrome' ) ;
61+ } ) ;
62+
63+ it ( 'leaves other protocols untouched for basius' , ( ) => {
64+ process . env . REACT_APP_AGENT_NAME = 'basius' ;
65+
66+ const { normalizeProtocol } = require ( '../../src/utils/agentMap' ) ;
67+ expect ( normalizeProtocol ( 'balancerPool' ) ) . toBe ( 'balancerPool' ) ;
68+ expect ( normalizeProtocol ( 'uniswapV3' ) ) . toBe ( 'uniswapV3' ) ;
69+ expect ( normalizeProtocol ( 'aerodrome' ) ) . toBe ( 'aerodrome' ) ;
70+ } ) ;
71+
72+ it ( 'leaves velodrome untouched for modius' , ( ) => {
73+ process . env . REACT_APP_AGENT_NAME = 'modius' ;
74+
75+ const { normalizeProtocol } = require ( '../../src/utils/agentMap' ) ;
76+ expect ( normalizeProtocol ( 'velodrome' ) ) . toBe ( 'velodrome' ) ;
77+ } ) ;
78+
79+ it ( 'leaves velodrome untouched for optimus' , ( ) => {
80+ process . env . REACT_APP_AGENT_NAME = 'optimus' ;
81+
82+ const { normalizeProtocol } = require ( '../../src/utils/agentMap' ) ;
83+ expect ( normalizeProtocol ( 'velodrome' ) ) . toBe ( 'velodrome' ) ;
84+ } ) ;
85+ } ) ;
86+
87+ describe ( 'normalizeDetails' , ( ) => {
88+ it ( 'relabels velodrome case-insensitively for basius' , ( ) => {
89+ process . env . REACT_APP_AGENT_NAME = 'basius' ;
90+
91+ const { normalizeDetails } = require ( '../../src/utils/agentMap' ) ;
92+ expect ( normalizeDetails ( 'Velodrome pool' ) ) . toBe ( 'Aerodrome pool' ) ;
93+ expect ( normalizeDetails ( 'velodrome CL pool' ) ) . toBe ( 'Aerodrome CL pool' ) ;
94+ } ) ;
95+
96+ it ( 'leaves details without velodrome untouched for basius' , ( ) => {
97+ process . env . REACT_APP_AGENT_NAME = 'basius' ;
98+
99+ const { normalizeDetails } = require ( '../../src/utils/agentMap' ) ;
100+ expect ( normalizeDetails ( 'Balancer pool' ) ) . toBe ( 'Balancer pool' ) ;
101+ } ) ;
102+
103+ it ( 'leaves details untouched for modius' , ( ) => {
104+ process . env . REACT_APP_AGENT_NAME = 'modius' ;
105+
106+ const { normalizeDetails } = require ( '../../src/utils/agentMap' ) ;
107+ expect ( normalizeDetails ( 'Velodrome pool' ) ) . toBe ( 'Velodrome pool' ) ;
108+ } ) ;
109+
110+ it ( 'leaves details untouched for optimus' , ( ) => {
111+ process . env . REACT_APP_AGENT_NAME = 'optimus' ;
112+
113+ const { normalizeDetails } = require ( '../../src/utils/agentMap' ) ;
114+ expect ( normalizeDetails ( 'Velodrome pool' ) ) . toBe ( 'Velodrome pool' ) ;
115+ } ) ;
116+ } ) ;
54117} ) ;
0 commit comments