Skip to content

Commit bfd0fff

Browse files
authored
chore: [#1154] Fixes failing unit test (#1843)
1 parent 99ebbfc commit bfd0fff

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

packages/global-registrator/test/node/GlobalRegistrator.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('GlobalRegistrator', () => {
4848
GlobalRegistrator.register();
4949

5050
for (const property of SELF_REFERRING_PROPERTIES) {
51-
assert.strictEqual(global[property], global);
51+
assert.strictEqual((<any>global)[property], global);
5252
}
5353

5454
GlobalRegistrator.unregister();

packages/global-registrator/test/node/lit-element/LitElement.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ describe('LitElement', () => {
1212

1313
document.body.innerHTML = `<lit-element-component prop1="${PROP1}"></lit-element-component>`;
1414

15-
const litElement = document.body.querySelector('lit-element-component');
16-
const shadowRoot = litElement.shadowRoot;
15+
const litElement = document.body.querySelector('lit-element-component')!;
16+
const shadowRoot = litElement.shadowRoot!;
1717

1818
await new Promise((resolve) => setTimeout(() => resolve(null), 100));
1919

@@ -22,10 +22,10 @@ describe('LitElement', () => {
2222
`<lit-element-component prop1="${PROP1}"></lit-element-component>`
2323
);
2424

25-
assert.strictEqual(shadowRoot.querySelector('span').innerText, PROP1);
26-
assert.strictEqual(window.getComputedStyle(shadowRoot.querySelector('span')).color, 'green');
25+
assert.strictEqual(shadowRoot.querySelector('span')!.innerText, PROP1);
26+
assert.strictEqual(window.getComputedStyle(shadowRoot.querySelector('span')!).color, 'green');
2727
assert.strictEqual(
28-
shadowRoot.innerHTML
28+
shadowRoot!.innerHTML
2929
.replace(/[\s]/gm, '')
3030
.replace(/<!--\?lit\$[0-9]+\$-->/gm, '<!--?lit$123456$-->'),
3131
`

packages/global-registrator/test/node/lit-element/LitElementComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default class LitElementComponent extends LitElement {
1313
`;
1414

1515
@property({ type: String })
16-
public prop1: string = null;
16+
public prop1: string | null = null;
1717

1818
/**
1919
* Renders the component.

packages/global-registrator/test/node/react/React.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import GlobalRegistrator from '../../../cjs/GlobalRegistrator.cjs';
1+
import GlobalRegistrator from '../../../lib/GlobalRegistrator.js';
22
import React from 'react';
33
import ReactDOM from 'react-dom/client';
44
import { act } from 'react-dom/test-utils';
@@ -8,10 +8,10 @@ import assert from 'node:assert';
88

99
describe('React', () => {
1010
it('Tests integration.', async () => {
11-
GlobalRegistrator.default.register();
11+
GlobalRegistrator.register();
1212

1313
const appElement = document.createElement('app');
14-
let root;
14+
let root: ReactDOM.Root | null = null;
1515
document.body.appendChild(appElement);
1616

1717
async function mountReactComponent(): Promise<void> {
@@ -27,7 +27,7 @@ describe('React', () => {
2727

2828
function unmountReactComponent(): void {
2929
act(() => {
30-
root.unmount();
30+
root!.unmount();
3131
});
3232

3333
assert.strictEqual(appElement.innerHTML, '');
@@ -36,6 +36,6 @@ describe('React', () => {
3636
await mountReactComponent();
3737
unmountReactComponent();
3838

39-
GlobalRegistrator.default.unregister();
39+
GlobalRegistrator.unregister();
4040
});
4141
});

packages/global-registrator/test/node/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"include": [
1515
"@types/node",
1616
".",
17-
"../../lib"
17+
"../../lib",
18+
"../../cjs"
1819
]
1920
}

packages/global-registrator/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
},
3636
"include": [
3737
"@types/node",
38-
"src",
39-
"src/**/*.json"
38+
"src"
4039
]
4140
}

0 commit comments

Comments
 (0)