@@ -75,7 +75,7 @@ describe('journey-client', () => {
7575 } ) ;
7676
7777 test ( 'next() should send the current step and return the next step' , async ( ) => {
78- const initialStepPayload = createJourneyStep ( {
78+ const initialStep = createJourneyStep ( {
7979 authId : 'test-auth-id' ,
8080 callbacks : [
8181 {
@@ -85,7 +85,7 @@ describe('journey-client', () => {
8585 } ,
8686 ] ,
8787 } ) ;
88- const nextStepPayload = createJourneyStep ( {
88+ const nextStepPayload : Step = {
8989 authId : 'test-auth-id' ,
9090 callbacks : [
9191 {
@@ -94,8 +94,7 @@ describe('journey-client', () => {
9494 output : [ ] ,
9595 } ,
9696 ] ,
97- } ) ;
98- const initialStep = initialStepPayload ;
97+ } ;
9998
10099 mockFetch . mockResolvedValue ( new Response ( JSON . stringify ( nextStepPayload ) ) ) ;
101100
@@ -108,7 +107,7 @@ describe('journey-client', () => {
108107 // TODO: This should be /journeys?_action=next, but the current implementation calls /authenticate
109108 expect ( request . url ) . toBe ( 'https://test.com/json/realms/root/authenticate' ) ;
110109 expect ( request . method ) . toBe ( 'POST' ) ;
111- expect ( await request . json ( ) ) . toEqual ( initialStep ) ;
110+ expect ( await request . json ( ) ) . toEqual ( initialStep . payload ) ;
112111 expect ( nextStep ) . toHaveProperty ( 'type' , 'Step' ) ;
113112 expect ( nextStep && nextStep . payload ) . toEqual ( nextStepPayload ) ;
114113 } ) ;
@@ -242,22 +241,22 @@ describe('journey-client', () => {
242241 // TODO: Add tests for endSession when the test environment AbortSignal issue is resolved
243242 // test('endSession() should call the sessions endpoint with DELETE method', async () => {
244243 // mockFetch.mockResolvedValue(new Response('', { status: 200 }));
245-
244+ //
246245 // const client = await journey({ config: mockConfig });
247246 // await client.endSession();
248-
247+ //
249248 // expect(mockFetch).toHaveBeenCalledTimes(1);
250249 // const request = mockFetch.mock.calls[0][0] as Request;
251250 // expect(request.url).toBe('https://test.com/json/realms/root/sessions/');
252251 // expect(request.method).toBe('DELETE');
253252 // });
254-
253+ //
255254 // test('endSession() should handle query parameters', async () => {
256255 // mockFetch.mockResolvedValue(new Response('', { status: 200 }));
257-
256+ //
258257 // const client = await journey({ config: mockConfig });
259258 // await client.endSession({ query: { foo: 'bar' } });
260-
259+ //
261260 // expect(mockFetch).toHaveBeenCalledTimes(1);
262261 // const request = mockFetch.mock.calls[0][0] as Request;
263262 // expect(request.url).toBe('https://test.com/json/realms/root/sessions/?foo=bar');
0 commit comments