-
-
Notifications
You must be signed in to change notification settings - Fork 794
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support Ruby handlers with
::
in path definition (#1218)
- Loading branch information
Showing
4 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import splitHandlerPathAndName from '../splitHandlerPathAndName.js' | ||
|
||
const tests = [ | ||
{ | ||
description: 'ruby handler with namespace resolution operator ::', | ||
expected: ['./src/somefolder/source', 'LambdaFunctions::Handler.process'], | ||
handler: './src/somefolder/source.LambdaFunctions::Handler.process', | ||
}, | ||
{ | ||
description: 'ruby handler with multiple namespace resolution operators ::', | ||
expected: [ | ||
'./src/somefolder/source', | ||
'Functions::LambdaFunctions::Handler.process', | ||
], | ||
handler: | ||
'./src/somefolder/source.Functions::LambdaFunctions::Handler.process', | ||
}, | ||
{ | ||
description: 'ruby handler with namespace resolution operator ::, unnested', | ||
expected: ['source', 'LambdaFunctions::Handler.process'], | ||
handler: 'source.LambdaFunctions::Handler.process', | ||
}, | ||
{ | ||
description: | ||
'ruby handler with multiple namespace resolution operators ::, unnested', | ||
expected: ['./source', 'Functions::LambdaFunctions::Handler.process'], | ||
handler: './source.Functions::LambdaFunctions::Handler.process', | ||
}, | ||
{ | ||
description: 'ruby handler from kernel', | ||
expected: ['./src/somefolder/function', 'handler'], | ||
handler: './src/somefolder/function.handler', | ||
}, | ||
{ | ||
description: 'generic handler', | ||
expected: ['./src/somefolder/.handlers/handler', 'run'], | ||
handler: './src/somefolder/.handlers/handler.run', | ||
}, | ||
{ | ||
description: 'generic handler, unnested', | ||
expected: ['handler', 'run'], | ||
handler: 'handler.run', | ||
}, | ||
] | ||
|
||
describe('splitHandlerPathAndName', () => { | ||
tests.forEach(({ description, expected, handler }) => { | ||
test(`should split ${description}`, () => { | ||
const result = splitHandlerPathAndName(handler) | ||
expect(result).toEqual(expected) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters