|
| 1 | +import { splitByScope } from '../authorization'; |
1 | 2 | import { __experimental_JWTPayloadToAuthObjectProperties as JWTPayloadToAuthObjectProperties } from '../jwtPayloadParser'; |
2 | 3 |
|
3 | 4 | const baseClaims = { |
@@ -186,35 +187,35 @@ describe('JWTPayloadToAuthObjectProperties', () => { |
186 | 187 |
|
187 | 188 | describe('splitByScope ', () => { |
188 | 189 | test('returns empty array when no features are present', () => { |
189 | | - const { orgFeatures } = splitByScope(''); |
190 | | - expect(orgFeatures).toEqual([]); |
| 190 | + const { org } = splitByScope(''); |
| 191 | + expect(org).toEqual([]); |
191 | 192 | }); |
192 | 193 |
|
193 | 194 | test('only org features included', () => { |
194 | | - const { orgFeatures, userFeatures } = splitByScope('o:impersonation,o:payments'); |
195 | | - expect(orgFeatures).toEqual(['impersonation', 'payments']); |
| 195 | + const { org, user } = splitByScope('o:impersonation,o:payments'); |
| 196 | + expect(org).toEqual(['impersonation', 'payments']); |
196 | 197 |
|
197 | | - expect(userFeatures).toEqual([]); |
| 198 | + expect(user).toEqual([]); |
198 | 199 | }); |
199 | 200 |
|
200 | 201 | test('only user features included', () => { |
201 | | - const { orgFeatures, userFeatures } = splitByScope('u:impersonation,u:payments'); |
202 | | - expect(orgFeatures).toEqual([]); |
| 202 | + const { org, user } = splitByScope('u:impersonation,u:payments'); |
| 203 | + expect(org).toEqual([]); |
203 | 204 |
|
204 | | - expect(userFeatures).toEqual(['impersonation', 'payments']); |
| 205 | + expect(user).toEqual(['impersonation', 'payments']); |
205 | 206 | }); |
206 | 207 |
|
207 | 208 | test('both org and user features included', () => { |
208 | | - const { orgFeatures, userFeatures } = splitByScope('o:payments,u:impersonation'); |
209 | | - expect(orgFeatures).toEqual(['payments']); |
| 209 | + const { org, user } = splitByScope('o:payments,u:impersonation'); |
| 210 | + expect(org).toEqual(['payments']); |
210 | 211 |
|
211 | | - expect(userFeatures).toEqual(['impersonation']); |
| 212 | + expect(user).toEqual(['impersonation']); |
212 | 213 | }); |
213 | 214 |
|
214 | 215 | test('features have multiple scopes', () => { |
215 | | - const { orgFeatures, userFeatures } = splitByScope('ou:payments,u:impersonation'); |
216 | | - expect(orgFeatures).toEqual(['payments']); |
| 216 | + const { org, user } = splitByScope('ou:payments,u:impersonation'); |
| 217 | + expect(org).toEqual(['payments']); |
217 | 218 |
|
218 | | - expect(userFeatures).toEqual(['payments', 'impersonation']); |
| 219 | + expect(user).toEqual(['payments', 'impersonation']); |
219 | 220 | }); |
220 | 221 | }); |
0 commit comments