@@ -19,7 +19,6 @@ const AccessController = require('../lib/accesscontroller');
1919const AclManager = require ( 'composer-common' ) . AclManager ;
2020const Api = require ( '../lib/api' ) ;
2121const BusinessNetworkDefinition = require ( 'composer-common' ) . BusinessNetworkDefinition ;
22- const BusinessNetworkMetadata = require ( 'composer-common' ) . BusinessNetworkMetadata ;
2322const CompiledAclBundle = require ( '../lib/compiledaclbundle' ) ;
2423const CompiledQueryBundle = require ( '../lib/compiledquerybundle' ) ;
2524const CompiledScriptBundle = require ( '../lib/compiledscriptbundle' ) ;
@@ -77,39 +76,16 @@ describe('Context', () => {
7776 } ) . should . throw ( / N o b u s i n e s s n e t w o r k / i) ;
7877 } ) ;
7978
80- it ( 'should enable historian if no request to disable is present' , ( ) => {
81- context . historianEnabled . should . be . true ;
82- } ) ;
83-
84- it ( 'should disable historian if disableHistorian set to true' , ( ) => {
79+ it ( 'should disable historian if InstalledBusinessNetwork says disabled' , ( ) => {
8580 const mockInstalledBusinessNetwork = sinon . createStubInstance ( InstalledBusinessNetwork ) ;
86- const mockBusinessNetworkDefinition = sinon . createStubInstance ( BusinessNetworkDefinition ) ;
87- mockInstalledBusinessNetwork . getDefinition . returns ( mockBusinessNetworkDefinition ) ;
88- const mockBusinessNetworkMetadata = sinon . createStubInstance ( BusinessNetworkMetadata ) ;
89- mockBusinessNetworkDefinition . getMetadata . returns ( mockBusinessNetworkMetadata ) ;
90- mockBusinessNetworkMetadata . getPackageJson . returns ( { 'disableHistorian' : true } ) ;
81+ mockInstalledBusinessNetwork . historianEnabled = false ;
9182 context = new Context ( mockEngine , mockInstalledBusinessNetwork ) ;
9283 context . historianEnabled . should . be . false ;
9384 } ) ;
9485
95- it ( 'should enable historian if disableHistorian set to false' , ( ) => {
96- const mockInstalledBusinessNetwork = sinon . createStubInstance ( InstalledBusinessNetwork ) ;
97- const mockBusinessNetworkDefinition = sinon . createStubInstance ( BusinessNetworkDefinition ) ;
98- mockInstalledBusinessNetwork . getDefinition . returns ( mockBusinessNetworkDefinition ) ;
99- const mockBusinessNetworkMetadata = sinon . createStubInstance ( BusinessNetworkMetadata ) ;
100- mockBusinessNetworkDefinition . getMetadata . returns ( mockBusinessNetworkMetadata ) ;
101- mockBusinessNetworkMetadata . getPackageJson . returns ( { 'disableHistorian' : false } ) ;
102- context = new Context ( mockEngine , mockInstalledBusinessNetwork ) ;
103- context . historianEnabled . should . be . true ;
104- } ) ;
105-
106- it ( 'should disable historian if disableHistorian set to a non boolean' , ( ) => {
86+ it ( 'should enable historian if InstalledBusinessNetwork says enabled' , ( ) => {
10787 const mockInstalledBusinessNetwork = sinon . createStubInstance ( InstalledBusinessNetwork ) ;
108- const mockBusinessNetworkDefinition = sinon . createStubInstance ( BusinessNetworkDefinition ) ;
109- mockInstalledBusinessNetwork . getDefinition . returns ( mockBusinessNetworkDefinition ) ;
110- const mockBusinessNetworkMetadata = sinon . createStubInstance ( BusinessNetworkMetadata ) ;
111- mockBusinessNetworkDefinition . getMetadata . returns ( mockBusinessNetworkMetadata ) ;
112- mockBusinessNetworkMetadata . getPackageJson . returns ( { 'disableHistorian' : 1 } ) ;
88+ mockInstalledBusinessNetwork . historianEnabled = true ;
11389 context = new Context ( mockEngine , mockInstalledBusinessNetwork ) ;
11490 context . historianEnabled . should . be . true ;
11591 } ) ;
0 commit comments