@@ -30,6 +30,7 @@ describe('exportFunctions() function exporter test suite', () => {
30
30
beforeEach ( ( ) => {
31
31
jest . resetAllMocks ( ) ;
32
32
delete process . env . K_SERVICE ;
33
+ delete process . env . FUNCTION_NAME ;
33
34
} ) ;
34
35
35
36
beforeAll ( ( ) => {
@@ -87,14 +88,22 @@ describe('exportFunctions() function exporter test suite', () => {
87
88
expect ( testObj ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 1 ] ) , randOutput ) ;
88
89
} ) ;
89
90
90
- it ( 'should only extract one module when FUNCTION_NAME present' , ( ) => {
91
+ it ( 'should only extract one module when K_SERVICE present' , ( ) => {
91
92
process . env . K_SERVICE = bff . funcNameFromRelPathDefault ( testFiles [ 1 ] ) ;
92
93
const result = exportTestFactory ( { enableLogger : true } ) ;
93
94
expect ( result ) . not . toHaveProperty ( filePathToPropertyPath ( testFiles [ 2 ] ) ) ;
94
95
expect ( result ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 1 ] ) ) ;
95
96
expect ( Object . keys ( result ) ) . toHaveLength ( 1 ) ;
96
97
} ) ;
97
98
99
+ it ( 'should only extract one module when FUNCTION_NAME present' , ( ) => {
100
+ process . env . FUNCTION_NAME = bff . funcNameFromRelPathDefault ( testFiles [ 1 ] ) ;
101
+ const result = exportTestFactory ( { enableLogger : true } ) ;
102
+ expect ( result ) . not . toHaveProperty ( filePathToPropertyPath ( testFiles [ 2 ] ) ) ;
103
+ expect ( result ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 1 ] ) ) ;
104
+ expect ( Object . keys ( result ) ) . toHaveLength ( 1 ) ;
105
+ } ) ;
106
+
98
107
it ( 'will still work with glob match prepending ./ as in ./**/*.js' , ( ) => {
99
108
expect ( exportTestFactory ( { searchGlob : './**/*.func.ts' } ) ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 1 ] ) ) ;
100
109
expect ( exportTestFactory ( { searchGlob : '**/*.func.ts' } ) ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 1 ] ) ) ;
0 commit comments