Skip to content

Commit

Permalink
Fix event test
Browse files Browse the repository at this point in the history
  • Loading branch information
ncovercash committed Sep 25, 2024
1 parent 6e85a91 commit 8fb5642
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Root/FFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/Root/FFetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 8fb5642

Please sign in to comment.