mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-22 11:05:17 +00:00
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { splitTradePair } from '@/utils/formatters/pairFormat';
|
|
|
|
describe('splitTradePair', () => {
|
|
it('Extracts stake and quote currencies from spot pairs', () => {
|
|
expect(splitTradePair('BTC/USDT')).toEqual({ baseCurrency: 'BTC', quoteCurrency: 'USDT' });
|
|
expect(splitTradePair('USDT/BTC')).toEqual({ baseCurrency: 'USDT', quoteCurrency: 'BTC' });
|
|
expect(splitTradePair('USDT/USDT')).toEqual({ baseCurrency: 'USDT', quoteCurrency: 'USDT' });
|
|
expect(splitTradePair('USDT/USDT')).toEqual({ baseCurrency: 'USDT', quoteCurrency: 'USDT' });
|
|
});
|
|
it('Extracts stake and quote currencies from spot pairs', () => {
|
|
expect(splitTradePair('BTC/USDT:USDT')).toEqual({
|
|
baseCurrency: 'BTC',
|
|
quoteCurrency: 'USDT',
|
|
});
|
|
expect(splitTradePair('USDT/BTC:BTC')).toEqual({ baseCurrency: 'USDT', quoteCurrency: 'BTC' });
|
|
expect(splitTradePair('USDT/USDT:USDT')).toEqual({
|
|
baseCurrency: 'USDT',
|
|
quoteCurrency: 'USDT',
|
|
});
|
|
expect(splitTradePair('USDT/USDT:USDT')).toEqual({
|
|
baseCurrency: 'USDT',
|
|
quoteCurrency: 'USDT',
|
|
});
|
|
});
|
|
it('Does not fail on empty input', () => {
|
|
expect(splitTradePair('')).toEqual({ baseCurrency: '', quoteCurrency: '' });
|
|
expect(splitTradePair('USDT')).toEqual({ baseCurrency: '', quoteCurrency: 'USDT' });
|
|
});
|
|
});
|