File tree Expand file tree Collapse file tree 3 files changed +30
-5
lines changed
test/awsService/sagemaker Expand file tree Collapse file tree 3 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export async function deeplinkConnect(
8686 wsUrl : string ,
8787 token : string ,
8888 domain : string ,
89- appType : string
89+ appType ? : string
9090) {
9191 getLogger ( ) . debug (
9292 `sm:deeplinkConnect: connectionIdentifier: ${ connectionIdentifier } session: ${ session } wsUrl: ${ wsUrl } token: ${ token } `
Original file line number Diff line number Diff line change @@ -28,15 +28,16 @@ export function register(ctx: ExtContext) {
2828}
2929
3030export function parseConnectParams ( query : SearchParams ) {
31- const params = query . getFromKeysOrThrow (
31+ const requiredParams = query . getFromKeysOrThrow (
3232 'connection_identifier' ,
3333 'domain' ,
3434 'user_profile' ,
3535 'session' ,
3636 'ws_url' ,
3737 'cell-number' ,
38- 'token' ,
39- 'app_type'
38+ 'token'
4039 )
41- return params
40+ const optionalParams = query . getFromKeys ( 'app_type' )
41+
42+ return { ...requiredParams , ...optionalParams }
4243}
Original file line number Diff line number Diff line change @@ -56,5 +56,29 @@ describe('SageMaker URI handler', function () {
5656 assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 3 ] , 'wss://example.com&cell-number=4' )
5757 assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 4 ] , 'my-token' )
5858 assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 5 ] , 'my-domain' )
59+ assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 6 ] , 'jupyterlab' )
60+ } )
61+
62+ it ( 'calls deeplinkConnect with undefined app_type when not provided' , async function ( ) {
63+ const params = {
64+ connection_identifier : 'abc123' ,
65+ domain : 'my-domain' ,
66+ user_profile : 'me' ,
67+ session : 'sess-xyz' ,
68+ ws_url : 'wss://example.com' ,
69+ 'cell-number' : '4' ,
70+ token : 'my-token' ,
71+ }
72+
73+ const uri = createConnectUri ( params )
74+ await handler . handleUri ( uri )
75+
76+ assert . ok ( deeplinkConnectStub . calledOnce )
77+ assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 1 ] , 'abc123' )
78+ assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 2 ] , 'sess-xyz' )
79+ assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 3 ] , 'wss://example.com&cell-number=4' )
80+ assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 4 ] , 'my-token' )
81+ assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 5 ] , 'my-domain' )
82+ assert . deepStrictEqual ( deeplinkConnectStub . firstCall . args [ 6 ] , undefined )
5983 } )
6084} )
You can’t perform that action at this time.
0 commit comments