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: 
useEffect has already been triggered and working, the point is that its an `async` operation. So you need to wait for the fetch to be completed. one of the ways that you can do that is:
1. write your assertion(s)
2. specify the number of assertion(s) in your test, so that jest knows that it has to wait for the operation to be completed.

```
 it('handles groupId and api call ', () => {
    // the effect will get called
    // the effect will call getGroups
    // the iframe will contain group parameters for the given groupId
    expect.assertions(1)
    const wrapper = shallow(<UsageWidget surface={`${USAGE_SURFACES.metrics}`} groupId={2} />)
    wrapper.update()
    expect(whatever your expectation is)
  });

```

since in this example i just wrote on assertion,

```
expect.assertions(1)

```

if you write more, you need to change the number.
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.