@@ -19,7 +19,6 @@ const AccessController = require('../lib/accesscontroller');
19
19
const AclManager = require ( 'composer-common' ) . AclManager ;
20
20
const Api = require ( '../lib/api' ) ;
21
21
const BusinessNetworkDefinition = require ( 'composer-common' ) . BusinessNetworkDefinition ;
22
- const BusinessNetworkMetadata = require ( 'composer-common' ) . BusinessNetworkMetadata ;
23
22
const CompiledAclBundle = require ( '../lib/compiledaclbundle' ) ;
24
23
const CompiledQueryBundle = require ( '../lib/compiledquerybundle' ) ;
25
24
const CompiledScriptBundle = require ( '../lib/compiledscriptbundle' ) ;
@@ -77,39 +76,16 @@ describe('Context', () => {
77
76
} ) . should . throw ( / N o b u s i n e s s n e t w o r k / i) ;
78
77
} ) ;
79
78
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' , ( ) => {
85
80
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 ;
91
82
context = new Context ( mockEngine , mockInstalledBusinessNetwork ) ;
92
83
context . historianEnabled . should . be . false ;
93
84
} ) ;
94
85
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' , ( ) => {
107
87
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 ;
113
89
context = new Context ( mockEngine , mockInstalledBusinessNetwork ) ;
114
90
context . historianEnabled . should . be . true ;
115
91
} ) ;
0 commit comments