forked from serverless/serverless-plugin-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypescript.extractFileName.test.ts
53 lines (50 loc) · 1.29 KB
/
typescript.extractFileName.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import {extractFileNames} from '../src/typescript'
import * as path from 'path'
const functions: { [key: string]: Serverless.Function } = {
hello: {
handler: 'tests/assets/hello.handler',
package: {
include: [],
exclude: [],
patterns: []
}
},
world: {
handler: 'tests/assets/world.handler',
package: {
include: [],
exclude: [],
patterns: []
}
},
js: {
handler: 'tests/assets/jsfile.create',
package: {
include: [],
exclude: [],
patterns: []
}
},
}
describe('extractFileName', () => {
it('get function filenames from serverless service for a non-google provider', () => {
expect(
extractFileNames(process.cwd(), 'aws', functions),
).toEqual(
[
'tests/assets/hello.ts',
'tests/assets/world.ts',
'tests/assets/jsfile.js',
],
)
})
it('get function filename from serverless service for a google provider', () => {
expect(
extractFileNames(path.join(process.cwd(), 'example'), 'google')
).toEqual(
[
'handler.ts'
]
)
})
})