ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / microsoft-authentication / src / common / test / scopeData.test.ts 135 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import * as assert from 'assert' ;
import { ScopeData } from '../scopeData' ;
import { Uri } from 'vscode' ;
suite ( 'ScopeData' , ( ) => {
test ( 'should include default scopes if not present' , ( ) => {
const scopeData = new ScopeData ( [ 'custom_scope' ] ) ;
assert. deepStrictEqual ( scopeData. allScopes,
scopeData
assert scopeData allScopes
scopeData
assert scopeData allScopes
scopeData
assert scopeData scopeStr
scopeData
assert scopeData scopesToSend
scopeData
assert scopeData scopesToSend
scopeData
assert scopeData clientId
scopeData
assert scopeData clientId
scopeData
assert scopeData tenant
scopeData
assert scopeData tenant
scopeData
assert scopeData tenantId
element
scopeData
assert scopeData tenantId
scopeData
assert scopeData tenantId
scopeData
assert scopeData claims
scopeData
assert scopeData claims
authorizationServer Uri
scopeData authorizationServer
assert scopeData tenant
authorizationServer Uri
scopeData authorizationServer
assert scopeData tenant
authorizationServer Uri
scopeData authorizationServer
assert scopeData tenant
authorizationServer Uri
scopeData authorizationServer
assert scopeData tenant
scopeData
assert scopeData clientId
scopeData
assert scopeData clientId
empty
assert empty clientId
whitespace
assert whitespace clientId
scopeData
assert scopeData clientId
[
'custom_scope'
]
)
;
}
)
;
test
(
'should not duplicate default scopes if already present'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
,
'openid'
,
'email'
,
'profile'
,
'offline_access'
]
)
;
.
deepStrictEqual
(
.
,
[
'custom_scope'
,
'email'
,
'offline_access'
,
'openid'
,
'profile'
]
)
;
}
)
;
test
(
'should sort the scopes alphabetically'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
,
'profile'
,
'email'
,
'openid'
,
'offline_access'
]
)
;
.
deepStrictEqual
(
.
,
[
'custom_scope'
,
'email'
,
'offline_access'
,
'openid'
,
'profile'
]
)
;
}
)
;
test
(
'should create a space-separated string of all scopes'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
,
'openid'
,
'email'
,
'offline_access'
,
'profile'
]
)
;
.
strictEqual
(
.
,
'custom_scope email offline_access openid profile'
)
;
}
)
;
test
(
'should add TACK ON scope if all scopes are OIDC scopes'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'openid'
,
'email'
,
'offline_access'
,
'profile'
]
)
;
.
deepStrictEqual
(
.
,
[
'email'
,
'offline_access'
,
'openid'
,
'profile'
,
'User.Read'
]
)
;
}
)
;
test
(
'should filter out internal VS Code scopes for scopesToSend'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
,
'VSCODE_CLIENT_ID:some_id'
]
)
;
.
deepStrictEqual
(
.
,
[
'custom_scope'
]
)
;
}
)
;
test
(
'should use the default client ID if no VSCODE_CLIENT_ID scope is present'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
]
)
;
.
strictEqual
(
.
,
'aebc6443-996d-45c2-90f0-388ff96faa56'
)
;
}
)
;
test
(
'should use the VSCODE_CLIENT_ID scope if present'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
,
'VSCODE_CLIENT_ID:some_id'
]
)
;
.
strictEqual
(
.
,
'some_id'
)
;
}
)
;
test
(
'should use the default tenant ID if no VSCODE_TENANT scope is present'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
]
)
;
.
strictEqual
(
.
,
'organizations'
)
;
}
)
;
test
(
'should use the VSCODE_TENANT scope if present'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
,
'VSCODE_TENANT:some_tenant'
]
)
;
.
strictEqual
(
.
,
'some_tenant'
)
;
}
)
;
test
(
'should have tenantId be undefined if no VSCODE_TENANT scope is present'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
]
)
;
.
strictEqual
(
.
,
undefined
)
;
}
)
;
test
(
'should have tenantId be undefined if typical tenant values are present'
,
(
)
=>
{
for
(
const
of
[
'common'
,
'organizations'
,
'consumers'
]
)
{
const
=
new
ScopeData
(
[
'custom_scope'
,
` VSCODE_TENANT: ${ element} `
]
)
;
.
strictEqual
(
.
,
undefined
)
;
}
}
)
;
test
(
'should have tenantId be the value of VSCODE_TENANT scope if set to a specific value'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
,
'VSCODE_TENANT:some_guid'
]
)
;
.
strictEqual
(
.
,
'some_guid'
)
;
}
)
;
test
(
'should not return claims'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
]
)
;
.
strictEqual
(
.
,
undefined
)
;
}
)
;
test
(
'should return claims'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
]
,
'test'
)
;
.
strictEqual
(
.
,
'test'
)
;
}
)
;
test
(
'should extract tenant from authorization server URL path'
,
(
)
=>
{
const
=
.
parse
(
'https://login.microsoftonline.com/tenant123/oauth2/v2.0'
)
;
const
=
new
ScopeData
(
[
'custom_scope'
]
,
undefined
,
)
;
.
strictEqual
(
.
,
'tenant123'
)
;
}
)
;
test
(
'should fallback to default tenant if authorization server URL has no path segments'
,
(
)
=>
{
const
=
.
parse
(
'https://login.microsoftonline.com'
)
;
const
=
new
ScopeData
(
[
'custom_scope'
]
,
undefined
,
)
;
.
strictEqual
(
.
,
'organizations'
)
;
}
)
;
test
(
'should prioritize authorization server URL over VSCODE_TENANT scope'
,
(
)
=>
{
const
=
.
parse
(
'https://login.microsoftonline.com/url_tenant/oauth2/v2.0'
)
;
const
=
new
ScopeData
(
[
'custom_scope'
,
'VSCODE_TENANT:scope_tenant'
]
,
undefined
,
)
;
.
strictEqual
(
.
,
'url_tenant'
)
;
}
)
;
test
(
'should extract tenant from v1.0 authorization server URL path'
,
(
)
=>
{
const
=
.
parse
(
'https://login.microsoftonline.com/tenant123'
)
;
const
=
new
ScopeData
(
[
'custom_scope'
]
,
undefined
,
)
;
.
strictEqual
(
.
,
'tenant123'
)
;
}
)
;
test
(
'should use explicit clientId when provided'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
]
,
undefined
,
undefined
,
'my-custom-client-id'
)
;
.
strictEqual
(
.
,
'my-custom-client-id'
)
;
}
)
;
test
(
'should use explicit clientId over VSCODE_CLIENT_ID scope'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
,
'VSCODE_CLIENT_ID:scope_id'
]
,
undefined
,
undefined
,
'override-id'
)
;
.
strictEqual
(
.
,
'override-id'
)
;
}
)
;
test
(
'should ignore empty or whitespace-only clientId and fall back to default'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
]
,
undefined
,
undefined
,
''
)
;
.
strictEqual
(
.
,
'aebc6443-996d-45c2-90f0-388ff96faa56'
)
;
const
=
new
ScopeData
(
[
'custom_scope'
]
,
undefined
,
undefined
,
' '
)
;
.
strictEqual
(
.
,
'aebc6443-996d-45c2-90f0-388ff96faa56'
)
;
}
)
;
test
(
'should ignore empty clientId and fall back to VSCODE_CLIENT_ID scope'
,
(
)
=>
{
const
=
new
ScopeData
(
[
'custom_scope'
,
'VSCODE_CLIENT_ID:scope_id'
]
,
undefined
,
undefined
,
''
)
;
.
strictEqual
(
.
,
'scope_id'
)
;
}
)
;
}
)
;