Skip to content

Commit

Permalink
capricorn86#509@patch: Fix GlobalRegistrator's unregister.
Browse files Browse the repository at this point in the history
  • Loading branch information
pearofducks committed Jun 18, 2022
1 parent f9d55eb commit f52cb2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/global-registrator/src/GlobalRegistrator.ts
Expand Up @@ -11,7 +11,7 @@ export default class GlobalRegistrator {
*/
public static register(): void {
if (this.registered.length) {
throw new Error('Failed to registered. Happy DOM has already been globally registered.');
throw new Error('Failed to register. Happy DOM has already been globally registered.');
}
const window = new GlobalWindow();
for (const key of Object.keys(window)) {
Expand All @@ -26,9 +26,9 @@ export default class GlobalRegistrator {
* Registers Happy DOM globally.
*/
public static unregister(): void {
if (this.registered.length) {
if (!this.registered.length) {
throw new Error(
'Failed to unregistered. Happy DOM has not previously been globally registered.'
'Failed to unregister. Happy DOM has not previously been globally registered.'
);
}
for (const key of this.registered) {
Expand Down
2 changes: 2 additions & 0 deletions packages/global-registrator/test/react/React.test.tsx
Expand Up @@ -26,3 +26,5 @@ function unmountReactComponent(): void {

mountReactComponent();
unmountReactComponent();

GlobalRegistrator.unregister();

0 comments on commit f52cb2a

Please sign in to comment.