Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Aug 20, 2021
1 parent d596598 commit 655d11f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ui/src/app/admin/hoc/RoleProvider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ import {useRole} from '../hooks';
jest.mock('../hooks');

describe('RoleProvider component', () => {
// let get;

beforeEach(() => {
test('should provide the role context', async () => {
let get = jest.fn().mockResolvedValue({ id: 'foo' });
useRole.mockImplementation(() => {
return {
get: jest.fn().mockResolvedValue({ id: 'foo' }),
get,
response: {
ok: false,
status: 200
}
};
});
})

test('should provide the role context', async () => {
act(() => {
render(<RoleProvider id={'foo'}>
{(role) => <div>{role?.id}</div>}
</RoleProvider>);
});

expect(useRole).toHaveBeenCalled();
expect(screen.getByText('foo')).toBeInTheDocument();
expect(get).toHaveBeenCalled();
});

})

0 comments on commit 655d11f

Please sign in to comment.