@yoroi/swap
Version:
The Swap package of Yoroi SDK
33 lines (32 loc) • 1.31 kB
JavaScript
;
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