All files / tests/segment init.js

100% Statements 19/19
100% Branches 0/0
100% Functions 3/3
100% Lines 19/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 331x   1x   1x   1x   1x 1x 1x   1x 1x       1x 1x 1x   1x 1x       1x 1x 1x 1x 1x    
const { expect } = require(`chai`);
 
const CoinpaymentsError = require(`../../lib/error`);
 
const { credentials } = require(`../config`);
 
const helper = require(`../helpers`);
 
it(`Should not initilize with missing public key`, function() {
  try {
    helper.getClient(Object.assign({}, credentials, { key: undefined }));
  } catch (exception) {
    expect(exception).to.be.instanceOf(CoinpaymentsError);
    expect(exception.message).to.equal(`Missing public key`);
  }
});
 
it(`Should not initilize with missing private key`, function() {
  try {
    helper.getClient(Object.assign({}, credentials, { secret: undefined }));
  } catch (exception) {
    expect(exception).to.be.instanceOf(CoinpaymentsError);
    expect(exception.message).to.equal(`Missing private key`);
  }
});
 
it(`Should initilize valid payload`, function() {
  const client = helper.getClient(credentials);
  expect(client).to.have.property(`credentials`);
  expect(client.credentials).to.have.property(`key`, `x`);
  expect(client.credentials).to.have.property(`secret`, `y`);
});