From 041a6f471f39ff20b5495f9428f6cc1781f7f0b8 Mon Sep 17 00:00:00 2001 From: Daniel Limia Date: Tue, 16 Jul 2019 12:41:49 +0200 Subject: [PATCH] Reenable skipped tests --- framework/src/controller/application.js | 2 +- .../__snapshots__/application.spec.js.snap | 2 +- .../unit/specs/controller/application.spec.js | 23 +++++++++++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/framework/src/controller/application.js b/framework/src/controller/application.js index 48ff1af011b..e92d609422a 100644 --- a/framework/src/controller/application.js +++ b/framework/src/controller/application.js @@ -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.` diff --git a/framework/test/jest/unit/specs/controller/__snapshots__/application.spec.js.snap b/framework/test/jest/unit/specs/controller/__snapshots__/application.spec.js.snap index 2b152ff1790..69fdc115c17 100644 --- a/framework/test/jest/unit/specs/controller/__snapshots__/application.spec.js.snap +++ b/framework/test/jest/unit/specs/controller/__snapshots__/application.spec.js.snap @@ -20,7 +20,7 @@ Object { }, }, "ipc": Object { - "enabled": true, + "enabled": false, }, "label": "devnet", "minVersion": "1.0.0", diff --git a/framework/test/jest/unit/specs/controller/application.spec.js b/framework/test/jest/unit/specs/controller/application.spec.js index 22905d2a8a7..c9b94766acc 100644 --- a/framework/test/jest/unit/specs/controller/application.spec.js +++ b/framework/test/jest/unit/specs/controller/application.spec.js @@ -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 { @@ -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']; @@ -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 @@ -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 = { @@ -184,7 +193,7 @@ describe.skip('Application', () => { expect(() => { new Application(genesisBlock, customConfig); - }).toThrow('Schema validation error'); + }).toThrow('should NOT have additional properties'); }); });