From 8fb564226145c774642755f2e34fa7574cc6ae96 Mon Sep 17 00:00:00 2001 From: Noah Overcash Date: Tue, 24 Sep 2024 20:23:40 -0400 Subject: [PATCH] Fix event test --- src/components/Root/FFetch.js | 2 +- src/components/Root/FFetch.test.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Root/FFetch.js b/src/components/Root/FFetch.js index d4eb92b9e..6a621b087 100644 --- a/src/components/Root/FFetch.js +++ b/src/components/Root/FFetch.js @@ -88,7 +88,7 @@ export class FFetch { registerEventListener = () => { this.globalEventCallback = () => { this.logger.log('rtr', 'forcing rotation due to RTR_FORCE_REFRESH_EVENT'); - rtr(this.nativeFetch, this.logger, this.rotateCallback); + rtr(this.nativeFetch, this.logger, this.rotateCallback, this.store.getState().okapi); }; window.addEventListener(RTR_FORCE_REFRESH_EVENT, this.globalEventCallback); } diff --git a/src/components/Root/FFetch.test.js b/src/components/Root/FFetch.test.js index b158bf1f6..1837e113c 100644 --- a/src/components/Root/FFetch.test.js +++ b/src/components/Root/FFetch.test.js @@ -4,6 +4,7 @@ import ms from 'ms'; import { waitFor } from '@testing-library/react'; +import { okapi } from 'stripes-config'; import { getTokenExpiry } from '../../loginServices'; import { FFetch } from './FFetch'; @@ -165,11 +166,11 @@ describe('FFetch class', () => { }); }); - describe.skip('force refresh event', () => { + describe('force refresh event', () => { it('Invokes a refresh on RTR_FORCE_REFRESH_EVENT...', async () => { mockFetch.mockResolvedValueOnce('okapi success'); - const instance = new FFetch({ logger: { log } }); + const instance = new FFetch({ logger: { log }, store: { getState: () => ({ okapi }) } }); instance.replaceFetch(); instance.replaceXMLHttpRequest();