-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathtypescript.extractFileName.test.ts
More file actions
66 lines (63 loc) · 1.58 KB
/
Copy pathtypescript.extractFileName.test.ts
File metadata and controls
66 lines (63 loc) · 1.58 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
import {extractFileNames} from '../src/typescript'
import * as path from 'path'
const functions: { [key: string]: Serverless.Function } = {
hello: {
handler: 'tests/assets/hello.handler',
runtime: 'nodejs10.1',
package: {
include: [],
exclude: [],
patterns: []
}
},
world: {
handler: 'tests/assets/world.handler',
runtime: 'nodejs10.1',
package: {
include: [],
exclude: [],
patterns: []
}
},
js: {
handler: 'tests/assets/jsfile.create',
runtime: 'nodejs10.1',
package: {
include: [],
exclude: [],
patterns: []
}
},
dockerBasedFunction: {
image: {
name: 'path/to/lambda/image'
},
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'
]
)
})
})