@@ -7,8 +7,6 @@ const sinon = require('sinon');
7
7
8
8
const _ = require ( 'lodash' ) ;
9
9
10
- const hasUserPrototype = ( obj ) => obj . constructor !== Object ;
11
-
12
10
const createFixture = async ( serviceManager ) => {
13
11
const { middlewares, controllers } = serviceManager ;
14
12
@@ -32,22 +30,13 @@ const createFixture = async (serviceManager) => {
32
30
controllers : Object . keys ( controllers ) . reduce ( ( result , key ) => {
33
31
const target = controllers [ key ] ;
34
32
35
- if ( hasUserPrototype ( target ) ) {
36
- result [ key ] = Object . getOwnPropertyNames ( Object . getPrototypeOf ( target ) )
37
- . filter ( ( _key ) => _key !== 'constructor' )
38
- . reduce ( ( _result , _key ) => {
39
- _result [ _key ] = sinon . stub ( ) . callsFake ( serviceFake ) ;
40
- return _result ;
41
- } , { } ) ;
42
- } else {
43
- result [ key ] = Object . keys ( target ) . reduce ( ( _result , _key ) => {
44
- const validations = _ . mapValues ( controllers [ key ] [ _key ] . validations , ( ) => sinon . stub ( ) . callsArg ( 2 ) ) ;
45
- const controllerStub = sinon . stub ( ) . callsFake ( serviceFake ) ;
46
- controllerStub . validations = validations ;
47
- _result [ _key ] = [ ...Object . values ( validations ) , controllerStub ] ;
48
- return _result ;
49
- } , { } ) ;
50
- }
33
+ result [ key ] = Object . keys ( target ) . reduce ( ( _result , _key ) => {
34
+ const validations = _ . mapValues ( controllers [ key ] [ _key ] . validations , ( ) => sinon . stub ( ) . callsArg ( 2 ) ) ;
35
+ const controllerStub = sinon . stub ( ) . callsFake ( serviceFake ) ;
36
+ controllerStub . validations = validations ;
37
+ _result [ _key ] = [ ...Object . values ( validations ) , controllerStub ] ;
38
+ return _result ;
39
+ } , { } ) ;
51
40
52
41
return result ;
53
42
} , { } ) ,
0 commit comments