@@ -11,18 +11,16 @@ import * as sdkOidc from '@forgerock/sdk-oidc';
1111import * as sdkUtilities from '@forgerock/sdk-utilities' ;
1212
1313import {
14- buildParBody ,
15- validateParResponse ,
16- handleDispatchError ,
17- createAuthorizeUrlMicro ,
18- } from './authorize.request.utils.js' ;
19- import {
14+ buildParBodyµ ,
2015 buildParSlimUrlµ ,
16+ createAuthorizeUrlµ ,
2117 dispatchAuthorizeFetchµ ,
2218 dispatchAuthorizeIframeµ ,
2319 generateAuthValuesµ ,
2420 generatePkceChallengeµ ,
21+ handleDispatchErrorµ ,
2522 storeAuthOptionsµ ,
23+ validateParResponseµ ,
2624} from './authorize.request.micros.js' ;
2725
2826import type { OidcConfig } from './config.types.js' ;
@@ -114,11 +112,11 @@ it.effect('generatePkceChallengeµ fails with auth_error when createChallenge th
114112 } ) ,
115113) ;
116114
117- // ─── buildParBody ─────────────────────────────────────────────────────────────
115+ // ─── buildParBodyµ ─────────────────────────────────────────────────────────────
118116
119- it . effect ( 'buildParBody returns URLSearchParams with expected fields' , ( ) =>
117+ it . effect ( 'buildParBodyµ returns URLSearchParams with expected fields' , ( ) =>
120118 Micro . gen ( function * ( ) {
121- const params = yield * buildParBody ( config , { } , 'challenge-abc' , 'state-xyz' ) ;
119+ const params = yield * buildParBodyµ ( config , { } , 'challenge-abc' , 'state-xyz' ) ;
122120 expect ( params . get ( 'client_id' ) ) . toBe ( clientId ) ;
123121 expect ( params . get ( 'code_challenge' ) ) . toBe ( 'challenge-abc' ) ;
124122 expect ( params . get ( 'state' ) ) . toBe ( 'state-xyz' ) ;
@@ -127,19 +125,19 @@ it.effect('buildParBody returns URLSearchParams with expected fields', () =>
127125 } ) ,
128126) ;
129127
130- it . effect ( 'buildParBody includes prompt when provided' , ( ) =>
128+ it . effect ( 'buildParBodyµ includes prompt when provided' , ( ) =>
131129 Micro . gen ( function * ( ) {
132- const params = yield * buildParBody ( config , { } , 'challenge-abc' , 'state-xyz' , 'login' ) ;
130+ const params = yield * buildParBodyµ ( config , { } , 'challenge-abc' , 'state-xyz' , 'login' ) ;
133131 expect ( params . get ( 'prompt' ) ) . toBe ( 'login' ) ;
134132 } ) ,
135133) ;
136134
137- it . effect ( 'buildParBody fails with auth_error when buildAuthorizeParams throws' , ( ) =>
135+ it . effect ( 'buildParBodyµ fails with auth_error when buildAuthorizeParams throws' , ( ) =>
138136 Micro . gen ( function * ( ) {
139137 vi . spyOn ( sdkOidc , 'buildAuthorizeParams' ) . mockImplementation ( ( ) => {
140138 throw new Error ( 'build failed' ) ;
141139 } ) ;
142- const exit = yield * Micro . exit ( buildParBody ( config , { } , 'ch' , 'st' ) ) ;
140+ const exit = yield * Micro . exit ( buildParBodyµ ( config , { } , 'ch' , 'st' ) ) ;
143141 expect ( Micro . exitIsFailure ( exit ) ) . toBe ( true ) ;
144142 if ( ! Micro . exitIsFailure ( exit ) || ! Micro . causeIsFail ( exit . cause ) ) return ;
145143 expect ( exit . cause . error . type ) . toBe ( 'auth_error' ) ;
@@ -199,21 +197,21 @@ it.effect('storeAuthOptionsµ fails with unknown_error when store function throw
199197 } ) ,
200198) ;
201199
202- // ─── validateParResponse ──────────────────────────────────────────────────────
200+ // ─── validateParResponseµ ──────────────────────────────────────────────────────
203201
204- it . effect ( 'validateParResponse succeeds when request_uri is present' , ( ) =>
202+ it . effect ( 'validateParResponseµ succeeds when request_uri is present' , ( ) =>
205203 Micro . gen ( function * ( ) {
206- const result = yield * validateParResponse ( {
204+ const result = yield * validateParResponseµ ( {
207205 data : { request_uri : 'urn:ietf:params:oauth:request_uri:xyz' , expires_in : 60 } ,
208206 } ) ;
209207 expect ( result . request_uri ) . toBe ( 'urn:ietf:params:oauth:request_uri:xyz' ) ;
210208 } ) ,
211209) ;
212210
213- it . effect ( 'validateParResponse fails with network_error on RTK error' , ( ) =>
211+ it . effect ( 'validateParResponseµ fails with network_error on RTK error' , ( ) =>
214212 Micro . gen ( function * ( ) {
215213 const exit = yield * Micro . exit (
216- validateParResponse ( {
214+ validateParResponseµ ( {
217215 error : {
218216 status : 400 ,
219217 data : { error : 'invalid_client' , error_description : 'bad creds' , type : 'auth_error' } ,
@@ -226,19 +224,19 @@ it.effect('validateParResponse fails with network_error on RTK error', () =>
226224 } ) ,
227225) ;
228226
229- it . effect ( 'validateParResponse fails with network_error when request_uri is absent' , ( ) =>
227+ it . effect ( 'validateParResponseµ fails with network_error when request_uri is absent' , ( ) =>
230228 Micro . gen ( function * ( ) {
231- const exit = yield * Micro . exit ( validateParResponse ( { data : { expires_in : 60 } } ) ) ;
229+ const exit = yield * Micro . exit ( validateParResponseµ ( { data : { expires_in : 60 } } ) ) ;
232230 expect ( Micro . exitIsFailure ( exit ) ) . toBe ( true ) ;
233231 if ( ! Micro . exitIsFailure ( exit ) || ! Micro . causeIsFail ( exit . cause ) ) return ;
234232 expect ( exit . cause . error . type ) . toBe ( 'network_error' ) ;
235233 expect ( exit . cause . error . error_description ) . toContain ( 'request_uri' ) ;
236234 } ) ,
237235) ;
238236
239- // ─── createAuthorizeUrlMicro ──────────────────────────────────────────────────
237+ // ─── createAuthorizeUrlµ ──────────────────────────────────────────────────
240238
241- it . effect ( 'createAuthorizeUrlMicro returns [url, options] tuple' , ( ) =>
239+ it . effect ( 'createAuthorizeUrlµ returns [url, options] tuple' , ( ) =>
242240 Micro . gen ( function * ( ) {
243241 vi . stubGlobal ( 'sessionStorage' , sessionStorageStub ) ;
244242 const opts = {
@@ -252,20 +250,17 @@ it.effect('createAuthorizeUrlMicro returns [url, options] tuple', () =>
252250 vi . spyOn ( sdkOidc , 'createAuthorizeUrl' ) . mockResolvedValue (
253251 'https://example.com/authorize?foo=bar' ,
254252 ) ;
255- const [ url , returnedOpts ] = yield * createAuthorizeUrlMicro (
256- wellknown . authorization_endpoint ,
257- opts ,
258- ) ;
253+ const [ url , returnedOpts ] = yield * createAuthorizeUrlµ ( wellknown . authorization_endpoint , opts ) ;
259254 expect ( url ) . toBe ( 'https://example.com/authorize?foo=bar' ) ;
260255 expect ( returnedOpts ) . toBe ( opts ) ;
261256 } ) ,
262257) ;
263258
264- it . effect ( 'createAuthorizeUrlMicro fails with auth_error when createAuthorizeUrl rejects' , ( ) =>
259+ it . effect ( 'createAuthorizeUrlµ fails with auth_error when createAuthorizeUrl rejects' , ( ) =>
265260 Micro . gen ( function * ( ) {
266261 vi . spyOn ( sdkOidc , 'createAuthorizeUrl' ) . mockRejectedValue ( new Error ( 'url build failed' ) ) ;
267262 const exit = yield * Micro . exit (
268- createAuthorizeUrlMicro ( wellknown . authorization_endpoint , {
263+ createAuthorizeUrlµ ( wellknown . authorization_endpoint , {
269264 clientId,
270265 redirectUri,
271266 scope,
@@ -279,12 +274,12 @@ it.effect('createAuthorizeUrlMicro fails with auth_error when createAuthorizeUrl
279274 } ) ,
280275) ;
281276
282- // ─── handleDispatchError ──────────────────────────────────────────────────────
277+ // ─── handleDispatchErrorµ ──────────────────────────────────────────────────────
283278
284- it . effect ( 'handleDispatchError fails immediately for CONFIGURATION_ERROR' , ( ) =>
279+ it . effect ( 'handleDispatchErrorµ fails immediately for CONFIGURATION_ERROR' , ( ) =>
285280 Micro . gen ( function * ( ) {
286281 const exit = yield * Micro . exit (
287- handleDispatchError (
282+ handleDispatchErrorµ (
288283 {
289284 status : 'CUSTOM_ERROR' ,
290285 statusText : 'CONFIGURATION_ERROR' ,
@@ -301,13 +296,13 @@ it.effect('handleDispatchError fails immediately for CONFIGURATION_ERROR', () =>
301296 } ) ,
302297) ;
303298
304- it . effect ( 'handleDispatchError builds redirect URL for non-config errors' , ( ) =>
299+ it . effect ( 'handleDispatchErrorµ builds redirect URL for non-config errors' , ( ) =>
305300 Micro . gen ( function * ( ) {
306301 vi . spyOn ( sdkOidc , 'createAuthorizeUrl' ) . mockResolvedValue (
307302 'https://example.com/authorize?error=login_required' ,
308303 ) ;
309304 const exit = yield * Micro . exit (
310- handleDispatchError (
305+ handleDispatchErrorµ (
311306 {
312307 status : 400 ,
313308 data : {
0 commit comments