@@ -30,15 +30,18 @@ import { KoaContext } from '@vulcan-sql/serve/models';
30
30
import { Container } from 'inversify' ;
31
31
import { extensionModule } from '../src/containers/modules' ;
32
32
import { TYPES } from '@vulcan-sql/serve' ;
33
+ import { Evaluator } from '@vulcan-sql/serve/evaluator' ;
33
34
34
35
describe ( 'Test vulcan server for practicing middleware' , ( ) => {
35
36
let container : Container ;
36
37
let stubTemplateEngine : sinon . StubbedInstance < TemplateEngine > ;
37
38
let stubDataSource : sinon . StubbedInstance < DataSource > ;
39
+ let stubEvaluator : sinon . StubbedInstance < Evaluator > ;
38
40
beforeEach ( async ( ) => {
39
41
container = new Container ( ) ;
40
42
stubTemplateEngine = sinon . stubInterface < TemplateEngine > ( ) ;
41
43
stubDataSource = sinon . stubInterface < DataSource > ( ) ;
44
+ stubEvaluator = sinon . stubInterface < Evaluator > ( ) ;
42
45
43
46
await container . loadAsync (
44
47
coreExtensionModule ( {
@@ -76,6 +79,7 @@ describe('Test vulcan server for practicing middleware', () => {
76
79
router : [ ] ,
77
80
} )
78
81
) ;
82
+ container . bind ( TYPES . Evaluator ) . toConstantValue ( stubEvaluator ) ;
79
83
} ) ;
80
84
81
85
afterEach ( ( ) => {
@@ -116,6 +120,7 @@ describe('Test vulcan server for calling restful APIs', () => {
116
120
let container : Container ;
117
121
let stubTemplateEngine : sinon . StubbedInstance < TemplateEngine > ;
118
122
let stubDataSource : sinon . StubbedInstance < DataSource > ;
123
+ let stubEvaluator : sinon . StubbedInstance < Evaluator > ;
119
124
let server : http . Server ;
120
125
const fakeSchemas : Array < APISchema > = [
121
126
{
@@ -268,6 +273,7 @@ describe('Test vulcan server for calling restful APIs', () => {
268
273
container = new Container ( ) ;
269
274
stubTemplateEngine = sinon . stubInterface < TemplateEngine > ( ) ;
270
275
stubDataSource = sinon . stubInterface < DataSource > ( ) ;
276
+ stubEvaluator = sinon . stubInterface < Evaluator > ( ) ;
271
277
272
278
stubTemplateEngine . execute . callsFake ( async ( _ : string , data : any ) => {
273
279
return {
@@ -276,6 +282,8 @@ describe('Test vulcan server for calling restful APIs', () => {
276
282
} ;
277
283
} ) ;
278
284
285
+ stubEvaluator . evaluateProfile . returns ( 'profile1' ) ;
286
+
279
287
await container . loadAsync (
280
288
coreExtensionModule ( {
281
289
artifact : { } as any ,
@@ -312,6 +320,7 @@ describe('Test vulcan server for calling restful APIs', () => {
312
320
router : [ ] ,
313
321
} )
314
322
) ;
323
+ container . bind ( TYPES . Evaluator ) . toConstantValue ( stubEvaluator ) ;
315
324
} ) ;
316
325
317
326
afterEach ( ( ) => {
0 commit comments