You've already forked serverless-plugin-typescript
mirror of
https://github.com/encounter/serverless-plugin-typescript.git
synced 2026-03-30 11:37:55 -07:00
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import {extractFileNames} from '../src/typescript'
|
|
import {ServerlessFunction} from '../src/types'
|
|
import * as path from 'path'
|
|
|
|
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', () => {
|
|
it('get function filenames from serverless service for a non-google provider', () => {
|
|
expect(
|
|
extractFileNames(process.cwd(), 'aws', functions),
|
|
).toEqual(
|
|
[
|
|
'my-folder/hello.ts',
|
|
'my-folder/my-subfolder/world.ts',
|
|
'create.ts',
|
|
],
|
|
)
|
|
})
|
|
|
|
it('get function filename from serverless service for a google provider', () => {
|
|
expect(
|
|
extractFileNames(path.join(process.cwd(), 'example'), 'google')
|
|
).toEqual(
|
|
[
|
|
'handler.ts'
|
|
]
|
|
)
|
|
})
|
|
})
|