File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,8 @@ export function registerLambdaUriHandler() {
3131 globals . uriHandler . onPath ( '/lambda/load-function' , openFunctionHandler , parseOpenParams )
3232 )
3333}
34- function parseOpenParams ( query : SearchParams ) {
34+
35+ export function parseOpenParams ( query : SearchParams ) {
3536 return {
3637 functionName : query . getOrThrow (
3738 'functionName' ,
Original file line number Diff line number Diff line change 1+ /*!
2+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+ * SPDX-License-Identifier: Apache-2.0
4+ */
5+
6+ import assert from 'assert'
7+ import { SearchParams } from '../../shared/vscode/uriHandler'
8+ import { parseOpenParams } from '../../lambda/uriHandlers'
9+ import { globals } from '../../shared'
10+
11+ describe ( 'Lambda URI Handler' , function ( ) {
12+ describe ( 'load-function' , function ( ) {
13+ it ( 'registers for "/lambda/load-function"' , function ( ) {
14+ assert . throws ( ( ) => globals . uriHandler . onPath ( '/lambda/load-function' , ( ) => { } ) )
15+ } )
16+
17+ it ( 'parses parameters' , function ( ) {
18+ let query = new SearchParams ( {
19+ functionName : 'example' ,
20+ } )
21+ assert . throws ( ( ) => parseOpenParams ( query ) , / A r e g i o n m u s t b e p r o v i d e d / )
22+ query = new SearchParams ( {
23+ region : 'example' ,
24+ } )
25+ assert . throws ( ( ) => parseOpenParams ( query ) , / A f u n c t i o n n a m e m u s t b e p r o v i d e d / )
26+
27+ const valid = {
28+ functionName : 'example' ,
29+ region : 'example' ,
30+ isCfn : 'false' ,
31+ }
32+ query = new SearchParams ( valid )
33+ assert . deepEqual ( parseOpenParams ( query ) , valid )
34+ } )
35+ } )
36+ } )
You can’t perform that action at this time.
0 commit comments