Skip to content

Commit

Permalink
unit tests for simplexGetCurrencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamboster committed Nov 19, 2024
1 parent 4c33a02 commit e33c62d
Showing 1 changed file with 58 additions and 2 deletions.
60 changes: 58 additions & 2 deletions packages/bitcore-wallet-service/test/integration/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13181,6 +13181,62 @@ describe('Wallet service', function() {
});
});

describe('#simplexGetCurrencies', () => {
beforeEach(() => {
req = {
headers: {},
body: {
env: 'sandbox'
},
}
});

it('should work properly if req is OK', () => {
server.request = fakeRequest;
server.simplexGetCurrencies(req).then(data => {
should.exist(data);
}).catch(err => {
should.not.exist(err);
});
});

it('should work properly if req is OK for web', () => {
req.body.context = 'web';
server.request = fakeRequest;
server.simplexGetCurrencies(req).then(data => {
should.exist(data);
}).catch(err => {
should.not.exist(err);
});
});

it('should return error if get returns error', () => {
const fakeRequest2 = {
get: (_url, _opts, _cb) => { return _cb(new Error('Error'), null) },
};

server.request = fakeRequest2;
server.simplexGetCurrencies(req).then(data => {
should.not.exist(data);
}).catch(err => {
should.exist(err);
err.message.should.equal('Error');
});
});

it('should return error if simplex is commented in config', () => {
config.simplex = undefined;

server.request = fakeRequest;
server.simplexGetCurrencies(req).then(data => {
should.not.exist(data);
}).catch(err => {
should.exist(err);
err.message.should.equal('Simplex missing credentials');
});
});
});

describe('#simplexGetQuote', () => {
beforeEach(() => {
req = {
Expand Down Expand Up @@ -13238,7 +13294,7 @@ describe('Wallet service', function() {
});
});

describe.only('#simplexGetSellQuote', () => {
describe('#simplexGetSellQuote', () => {
beforeEach(() => {
req = {
headers: {},
Expand Down Expand Up @@ -13384,7 +13440,7 @@ describe('Wallet service', function() {
});
});

describe.only('#simplexSellPaymentRequest', () => {
describe('#simplexSellPaymentRequest', () => {
beforeEach(() => {
req = {
headers: {},
Expand Down

0 comments on commit e33c62d

Please sign in to comment.