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

Commit

Permalink
Merge pull request #3964 from LiskHQ/3947-Jest_application_tests_skipped
Browse files Browse the repository at this point in the history
Reenable and fix skipped Application unit tests - Closes #3947
  • Loading branch information
shuse2 authored Jul 17, 2019
2 parents 5bc4c40 + 243bf81 commit acffdbb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion framework/src/controller/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class Application {
*/
registerMigrations(namespace, migrations) {
assert(namespace, 'Namespace is required');
assert(migrations instanceof Array, 'Migrations list should be an array');
assert(Array.isArray(migrations), 'Migrations list should be an array');
assert(
!Object.keys(this.getMigrations()).includes(namespace),
`Migrations for "${namespace}" was already registered.`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Object {
},
},
"ipc": Object {
"enabled": true,
"enabled": false,
},
"label": "devnet",
"minVersion": "1.0.0",
Expand Down
23 changes: 16 additions & 7 deletions framework/test/jest/unit/specs/controller/application.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const {
} = require('@liskhq/lisk-transactions');

const _ = require('lodash');
const { validator: liskValidator } = require('@liskhq/lisk-validator');
const Application = require('../../../../../src/controller/application');
const validator = require('../../../../../src/controller/validator');
const {
Expand All @@ -28,16 +29,24 @@ const {
constantsSchema,
} = require('../../../../../src/controller/schema');

jest.mock('../../../../../src/components/logger');

const networkConfig = require('../../../../fixtures/config/devnet/config');
const genesisBlock = require('../../../../fixtures/config/devnet/genesis_block');

const config = {
...networkConfig,
};

jest.mock('../../../../../src/components/logger');
jest.mock('@liskhq/lisk-validator', () => ({
validator: {
validate: jest.fn().mockImplementation(() => {
return [];
}),
},
}));

// eslint-disable-next-line
describe.skip('Application', () => {
describe('Application', () => {
// Arrange
const frameworkTxTypes = ['0', '1', '2', '3', '4'];

Expand All @@ -50,10 +59,10 @@ describe.skip('Application', () => {
describe('#constructor', () => {
it('should validate genesisBlock', () => {
// Act
const validateSpy = jest.spyOn(validator, 'validate');

new Application(genesisBlock, config);
// Assert
expect(validateSpy).toHaveBeenNthCalledWith(
expect(liskValidator.validate).toHaveBeenNthCalledWith(
1,
genesisBlockSchema,
genesisBlock
Expand Down Expand Up @@ -175,7 +184,7 @@ describe.skip('Application', () => {

// Skipped because `new Application` is mutating params.config making the other tests to fail
// eslint-disable-next-line jest/no-disabled-tests
it.skip('[feature/improve_transactions_processing_efficiency] should throw validation error if constants are overriden by the user', () => {
it('should throw validation error if constants are overriden by the user', () => {
const customConfig = _.cloneDeep(config);

customConfig.app.genesisConfig = {
Expand All @@ -184,7 +193,7 @@ describe.skip('Application', () => {

expect(() => {
new Application(genesisBlock, customConfig);
}).toThrow('Schema validation error');
}).toThrow('should NOT have additional properties');
});
});

Expand Down

0 comments on commit acffdbb

Please sign in to comment.