jest.mock('@steerprotocol/sdk', () => { const Protocol = { Algebra: 'Algebra', AlgebraIntegral: 'AlgebraIntegral', AlgebraIntegralV2: 'AlgebraIntegralV2', DirectionalAlgebra: 'DirectionalAlgebra', MachineX: 'MachineX', ThickV2: 'ThickV2', Shadow: 'Shadow', PoolShark: 'PoolShark', Aerodrome: 'Aerodrome', Blackhole: 'Blackhole', }; return { Protocol, ALGEBRA_PROTOCOLS: [Protocol.Algebra], ALGEBRA_INTEGRAL_PROTOCOLS: [Protocol.AlgebraIntegral], ALGEBRA_INTEGRAL_V_2_0_PROTOCOLS: [Protocol.AlgebraIntegralV2], DIRECTIONAL_ALGEBRA_PROTOCOLS: [Protocol.DirectionalAlgebra], POOLSHARK_PROTOCOLS: [Protocol.PoolShark], AERODROME_PROTOCOLS: [Protocol.Aerodrome], isShadowProtocol: jest.fn( (protocol: string) => protocol === Protocol.Shadow, ), getProtocolTypeByBeacon: jest.fn(), }; }); import { ProtocolDetector } from '../../src/helpers/ProtocolDetector'; describe('ProtocolDetector additional behavior', () => { const sdk = require('@steerprotocol/sdk'); beforeEach(() => { sdk.getProtocolTypeByBeacon.mockReset(); }); it('detects algebra variants and directional algebra', () => { const detector = new ProtocolDetector(); sdk.getProtocolTypeByBeacon.mockReturnValue(sdk.Protocol.Algebra); expect(detector.isAlgebraVault('algebra')).toBe(true); sdk.getProtocolTypeByBeacon.mockReturnValue(sdk.Protocol.AlgebraIntegral); expect(detector.isAlgebraIntegralVault('integral')).toBe(true); sdk.getProtocolTypeByBeacon.mockReturnValue( sdk.Protocol.DirectionalAlgebra, ); expect(detector.isAlgebraUniDirectionalVault('directional')).toBe(true); }); it('detects thickv2 and blackhole', () => { const detector = new ProtocolDetector(); sdk.getProtocolTypeByBeacon.mockReturnValue(sdk.Protocol.ThickV2); expect(detector.isThickV2Vault('thick')).toBe(true); sdk.getProtocolTypeByBeacon.mockReturnValue(sdk.Protocol.Blackhole); expect(detector.isBlackholeVault('blackhole')).toBe(true); }); });