Files

52 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

2017-06-10 11:24:17 +02:00
import {extractFileNames} from '../src/typescript'
import {ServerlessFunction} from '../src/types'
2017-08-10 14:54:22 +10:00
import * as path from 'path'
2017-06-10 11:24:17 +02:00
const functions: { [key: string]: ServerlessFunction } = {
hello: {
handler: 'my-folder/hello.handler',
package: {
include: [],
exclude: []
}
},
world: {
handler: 'my-folder/my-subfolder/world.handler',
package: {
include: [],
exclude: []
}
},
create: {
handler: 'create.create',
package: {
include: [],
exclude: []
}
},
}
describe('extractFileName', () => {
2017-08-10 14:54:22 +10:00
it('get function filenames from serverless service for a non-google provider', () => {
2017-06-10 11:24:17 +02:00
expect(
2017-08-10 14:54:22 +10:00
extractFileNames(process.cwd(), 'aws', functions),
2017-06-10 11:24:17 +02:00
).toEqual(
[
'my-folder/hello.ts',
'my-folder/my-subfolder/world.ts',
'create.ts',
],
)
})
2017-08-10 14:54:22 +10:00
it('get function filename from serverless service for a google provider', () => {
expect(
extractFileNames(path.join(process.cwd(), 'example'), 'google')
).toEqual(
[
'handler.ts'
]
)
})
})