Question: I'm having problems renewing an RHEL Developer account subscription, which expired a few days ago.  

I performed the following steps, but still, subscription-manager notifies me that: `Unable to find available subscriptions for all your installed products.`

```
[qa@brendan ~]$ sudo subscription-manager remove --all
0 subscriptions removed at the server.
[qa@brendan ~]$ sudo subscription-manager unregister
Unregistering from: subscription.rhsm.redhat.com:443/subscription
System has been unregistered.
[qa@brendan ~]$ sudo subscription-manager clean
All local data removed
[qa@brendan ~]$ sudo subscription-manager register
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: brendanjsonar
Password:
The system has been registered with ID: 7fe89b83-6ec2-423c-9476-062ab20d286a
The registered system name is: brendan.local
[qa@brendan ~]$ sudo subscription-manager refresh
All local data refreshed
[qa@brendan ~]$ sudo subscription-manager attach --auto
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Unable to find available subscriptions for all your installed products.
[qa@brendan ~]$ 

```

I also unregistered the system manually in <https://access.redhat.com/management/systems>, but the registration (with `sudo subscription-manager register --username brendanjsonar --auto-attach`) still complains `Unable to find available subscriptions for all your installed products.`

Any idea of how to renew my RHEL 7.6 system's registration?

Answer: 
With jest you can always mock. So what you need is:

1. In your unit test mock useEffect from React

```
jest.mock('React', () => ({
  ...jest.requireActual('React'),
  useEffect: jest.fn(),
}));

```

That allows to mock only useEffect and keep other implementation actual.

2. Import useEffect to use it in the test

```
import { useEffect } from 'react';

```

3. And finally in your test call the mock after the component is rendered

```
useEffect.mock.calls[0](); // <<-- That will call implementation of your useEffect

```
You can set a timeout to asynchronously check if the the expected condition has been met.

```
it('handles groupId and api call ', (done) => {
  const wrapper = shallow(<UsageWidget surface={`${USAGE_SURFACES.metrics}`} groupId={1} />) 
  setTimeout(() => {
    expect(wrapper.find("iframe").prop('src')).toBeTruthy(); // or whatever
    done();
  }, 5000);
}

```

The timeout lets you wait for the async fetch to complete. Call `done()` at the end to signal that the `it()` block is complete.

You probably also want to do a [mock implementation](https://jestjs.io/docs/en/mock-functions#mock-implementations) of your `getGroups` function so that you're not actually hitting a network API every time you test your code.