@@ -14,7 +14,8 @@ const functions: { [key: string]: Serverless.Function } = {
1414 package : {
1515 include : [ ] ,
1616 exclude : [ ]
17- }
17+ } ,
18+ runtime : 'nodejs12.x'
1819 } ,
1920 js : {
2021 handler : 'tests/assets/jsfile.create' ,
@@ -23,28 +24,82 @@ const functions: { [key: string]: Serverless.Function } = {
2324 exclude : [ ]
2425 }
2526 } ,
27+ notActuallyTypescript : {
28+ handler : 'tests/assets/jsfile.create' ,
29+ package : {
30+ include : [ ] ,
31+ exclude : [ ]
32+ } ,
33+ runtime : 'go1.x'
34+ } ,
2635}
2736
2837describe ( 'extractFileName' , ( ) => {
29- it ( 'get function filenames from serverless service for a non-google provider' , ( ) => {
30- expect (
31- extractFileNames ( process . cwd ( ) , 'aws' , functions ) ,
32- ) . toEqual (
33- [
34- 'tests/assets/hello.ts' ,
35- 'tests/assets/world.ts' ,
36- 'tests/assets/jsfile.js' ,
37- ] ,
38- )
38+ describe ( 'when the provider runtime is Node' , ( ) => {
39+ it ( 'can get function filenames from serverless service for a non-google provider' , ( ) => {
40+ expect (
41+ extractFileNames ( process . cwd ( ) , 'aws' , 'nodejs10.x' , functions ) ,
42+ ) . toEqual (
43+ [
44+ 'tests/assets/hello.ts' ,
45+ 'tests/assets/world.ts' ,
46+ 'tests/assets/jsfile.js' ,
47+ ] ,
48+ )
49+ } )
50+
51+ it ( 'can get function filename from serverless service for a google provider' , ( ) => {
52+ expect (
53+ extractFileNames ( path . join ( process . cwd ( ) , 'example' ) , 'google' , 'nodejs' )
54+ ) . toEqual (
55+ [
56+ 'handler.ts'
57+ ]
58+ )
59+ } )
60+ } )
61+ describe ( 'when the provider runtime is not node' , ( ) => {
62+ it ( 'can get function filenames from serverless service for a non-google provider' , ( ) => {
63+ expect (
64+ extractFileNames ( process . cwd ( ) , 'aws' , 'python2.7' , functions ) ,
65+ ) . toEqual (
66+ [
67+ 'tests/assets/world.ts' ,
68+ ] ,
69+ )
70+ } )
71+
72+ it ( 'can get function filename from serverless service for a google provider' , ( ) => {
73+ expect (
74+ extractFileNames ( path . join ( process . cwd ( ) , 'example' ) , 'google' , 'python37' )
75+ ) . toEqual (
76+ [
77+ 'handler.ts'
78+ ]
79+ )
80+ } )
3981 } )
82+ describe ( 'when the provider runtime is undefined' , ( ) => {
83+ it ( 'can get function filenames from serverless service for a non-google provider' , ( ) => {
84+ expect (
85+ extractFileNames ( process . cwd ( ) , 'aws' , undefined , functions ) ,
86+ ) . toEqual (
87+ [
88+ 'tests/assets/hello.ts' ,
89+ 'tests/assets/world.ts' ,
90+ 'tests/assets/jsfile.js' ,
91+ ] ,
92+ )
93+ } )
4094
41- it ( 'get function filename from serverless service for a google provider' , ( ) => {
42- expect (
43- extractFileNames ( path . join ( process . cwd ( ) , 'example' ) , 'google' )
44- ) . toEqual (
45- [
46- 'handler.ts'
47- ]
48- )
95+ it ( 'can get function filename from serverless service for a google provider' , ( ) => {
96+ expect (
97+ extractFileNames ( path . join ( process . cwd ( ) , 'example' ) , 'google' , undefined )
98+ ) . toEqual (
99+ [
100+ 'handler.ts'
101+ ]
102+ )
103+ } )
49104 } )
50105} )
0 commit comments