UNPKG

@yoroi/swap

Version:
33 lines (32 loc) 1.31 kB
"use strict"; var _api = require("../adapters/api/dexhunter/api.mocks"); var _getBestSwap = require("./getBestSwap"); describe('getBestSwap', () => { it('should return the best if no better, price = 0', () => { const best = _api.api.results.estimate; const estimate = _api.api.results.estimate; expect((0, _getBestSwap.getBestSwap)(0)(best, estimate)).toBe(estimate); }); it('should return the estimate when better, price = 0', () => { const best = _api.api.results.estimate; const estimate = { ..._api.api.results.estimate, totalOutput: _api.api.results.estimate.totalOutput + 1 }; expect((0, _getBestSwap.getBestSwap)(0)(best, estimate)).toBe(estimate); }); it('should return the best if no better, price = 1', () => { const best = _api.api.results.estimate; const estimate = _api.api.results.estimate; expect((0, _getBestSwap.getBestSwap)(1)(best, estimate)).toBe(estimate); }); it('should return the estimate when better, price = 1', () => { const best = _api.api.results.estimate; const estimate = { ..._api.api.results.estimate, totalOutput: _api.api.results.estimate.totalOutput + 1 }; expect((0, _getBestSwap.getBestSwap)(1)(best, estimate)).toBe(estimate); }); }); //# sourceMappingURL=getBestSwap.test.js.map