Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
update test case to pass travis
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLaw committed May 4, 2021
1 parent ce74a95 commit bebd40a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion catapult-sdk/src/plugins/catapultModelSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
/** @module plugins/catapultModelSystem */
const accountLink = require('./accountLink');
const aggregate = require('./aggregate');
const cmc = require('./cmc');
const lockHash = require('./lockHash');
const lockSecret = require('./lockSecret');
const metadata = require('./metadata');
Expand All @@ -31,7 +32,6 @@ const namespace = require('./namespace');
const receipts = require('./receipts');
const restrictions = require('./restrictions');
const transfer = require('./transfer');
const cmc = require('./cmc');
const ModelFormatterBuilder = require('../model/ModelFormatterBuilder');
const ModelSchemaBuilder = require('../model/ModelSchemaBuilder');
const ModelCodecBuilder = require('../modelBinary/ModelCodecBuilder');
Expand Down
4 changes: 4 additions & 0 deletions catapult-sdk/src/plugins/cmc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

/** @module plugins/cmc */

// To ensure cmc able to load from the config, created empty plugins

/* eslint-disable no-unused-vars */

/**
* Creates a cmc plugin use for CoinMarketCap.
* @type {module:plugins/CatapultPlugin}
Expand Down
3 changes: 2 additions & 1 deletion catapult-sdk/test/plugins/catapultModelSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ describe('catapult model system', () => {
'namespace',
'receipts',
'restrictions',
'transfer'
'transfer',
'cmc'
]);
});
});
Expand Down
17 changes: 12 additions & 5 deletions rest/test/plugins/cmc/cmcRoutes_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ describe('cmc routes', () => {
const maxSupply = 9000000000000000;
const XYMSupply = 8998999998000000;

sinon.stub(fs, 'readFile').callsFake((path, data, callback) =>
callback(null, `${'[chain]\n'
+ 'maxMosaicAtomicUnits = '}${maxSupply}\n`
+ 'currencyMosaicId = 1234567890ABCDEF'));

const mosaicsSample = [{
id: '',
mosaic: {
Expand Down Expand Up @@ -94,6 +89,9 @@ describe('cmc routes', () => {

describe('GET', () => {
it('network currency supply circulating', () => {
const readFileStub = sinon.stub(fs, 'readFile').callsFake((path, data, callback) =>
callback(null, `[chain]\nmaxMosaicAtomicUnits = ${maxSupply}\ncurrencyMosaicId = "0x1234567890ABCDEF"`));

const route = mockServer.getRoute('/network/currency/supply/circulating').get();

// Arrange:
Expand All @@ -105,10 +103,14 @@ describe('cmc routes', () => {
// Assert
expect(mockServer.next.calledOnce).to.equal(true);
expect(mockServer.send.firstCall.args[0]).to.equal(cmcUtils.convertToRelative(circulatingSupply));
readFileStub.restore();
});
});

it('network currency supply total', () => {
const readFileStub = sinon.stub(fs, 'readFile').callsFake((path, data, callback) =>
callback(null, '[chain]\ncurrencyMosaicId = 0x1234567890ABCDEF'));

const route = mockServer.getRoute('/network/currency/supply/total').get();

// Arrange:
Expand All @@ -119,10 +121,14 @@ describe('cmc routes', () => {
// Assert
expect(mockServer.next.calledOnce).to.equal(true);
expect(mockServer.send.firstCall.args[0]).to.equal(xymSupply);
readFileStub.restore();
});
});

it('network currency supply max', () => {
const readFileStub = sinon.stub(fs, 'readFile').callsFake((path, data, callback) =>
callback(null, `[chain]\nmaxMosaicAtomicUnits = ${maxSupply}`));

const route = mockServer.getRoute('/network/currency/supply/max').get();

// Arrange:
Expand All @@ -133,6 +139,7 @@ describe('cmc routes', () => {
// Assert
expect(mockServer.next.calledOnce).to.equal(true);
expect(mockServer.send.firstCall.args[0]).to.equal(mosaicMaxSupply);
readFileStub.restore();
});
});
});
Expand Down
3 changes: 2 additions & 1 deletion rest/test/plugins/routeSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ describe('route system', () => {
'namespace',
'receipts',
'restrictions',
'transfer'
'transfer',
'cmc'
]);
});

Expand Down

0 comments on commit bebd40a

Please sign in to comment.