Skip to content

Commit

Permalink
chore: Typescript Cleanup- Part 3 for Test Files (microsoft#7291)
Browse files Browse the repository at this point in the history
#### Details

As part of Typescript migration added/removed the error causing fields.

##### Motivation

TypeScript 5.0 has marked some options as deprecated. We can temporarily
override these deprecations, but the documented plan is for the ability
to override the flag to go away in TypeScript 5.5

##### Context

1.  **featureFlagStoreData**

- **Error:** Type '{ backLinkHandler: () => void;
diagnosticViewToggleFactory: DiagnosticViewToggleFactory;
featureFlagStoreData: FeatureFlagStoreData; }' is not assignable to type
'IntrinsicAttributes & AdHocToolsPanelProps & { children?: ReactNode;
}'.
Property 'featureFlagStoreData' does not exist on type
'IntrinsicAttributes & AdHocToolsPanelProps & { children?: ReactNode;
}'.

2. **avatarUrl: 'avatarUrl'**

- **Error:** Type '{ featureFlagStoreData: { 'test-flag': true; };
avatarUrl: string; tabClosed: boolean; deps: InteractiveHeaderDeps;
selectedPivot: DetailsViewPivotType.assessment; navMenu:
ReactFCWithDisplayName<...>; narrowModeStatus: NarrowModeStatus;
isSideNavOpen: false; setSideNavOpen: null; }' is not assignable to type
'InteractiveHeaderProps'.
- Object literal may only specify known properties, and 'avatarUrl' does
not exist in type 'InteractiveHeaderProps'.

3. **status: ManualTestStatus.FAIL**

- **Error:** Type '{ step: string; test:
VisualizationType.HeadingsAssessment; status: ManualTestStatus;
assessmentInstanceTableHandler: AssessmentInstanceTableHandler;
manualTestStepResultMap: { ...; }; assessmentsProvider:
AssessmentsProvider; featureFlagStoreData: FeatureFlagStoreData;
pathSnippetStoreData: { ...; }; }' is not assignable to type
'ManualTestStepViewProps'.
- Object literal may only specify known properties, and 'status' does
not exist in type 'ManualTestStepViewProps'.

4. **supportLinkHandler: null**

- **Error:** Type '{ deps: LaunchPanelHeaderDeps; title: string;
subtitle: string; supportLinkHandler: null; popupWindow: null;
featureFlags: null; openAdhocToolsPanel: null; dropdownClickHandler:
null; }' is not assignable to type 'LaunchPanelHeaderProps'.
- Object literal may only specify known properties, and
'supportLinkHandler' does not exist in type 'LaunchPanelHeaderProps'.
- In the reference file the supportLinkHandler is removed and
dropdownClickHandler is already defined in LaunchPanelHeaderDeps

5. **browserAdapter: browserAdapterMock.object**

- **Error:** Type '{ diagnosticViewClickHandler:
DiagnosticViewClickHandler; popupViewControllerHandler:
PopupViewControllerHandler; launchPanelHeaderClickHandler:
LaunchPanelHeaderClickHandler; browserAdapter: BrowserAdapter; }' is not
assignable to type 'PopupHandlers'.
- Object literal may only specify known properties, and 'browserAdapter'
does not exist in type 'PopupHandlers'.

6. **targetAppInfo**

- **Error:** Type '{ targetAppInfo: { name: string; url: string; };
description: string; environmentInfo: { browserSpec: string;
extensionVersion: string; axeCoreVersion: string; }; toUtcString: (date:
Date) => string; scanMetadata: ScanMetadata; }' is not assignable to
type 'DetailsSectionProps'.
- Object literal may only specify known properties, and 'targetAppInfo'
does not exist in type 'DetailsSectionProps'.
- Removed 'environmentInfo' property as there are no references defined
in 'DetailsSectionProps' type

7. **outcomeType: outcomeType,**

- **Error:** Type '{ customCongratsContinueInvestigatingMessage: string;
outcomeType: InstanceOutcomeType; }' is not assignable to type
'NoFailedInstancesCongratsDeps'.
- Object literal may only specify known properties, and 'outcomeType'
does not exist in type 'NoFailedInstancesCongratsDeps'.

8. **pageTitle**

- **Error:** Type '{ deps: ResultSectionContentDeps;
fixInstructionProcessor: FixInstructionProcessor; recommendColor:
RecommendColor; ... 13 more ...; sectionHeadingLevel: 3; }' is not
assignable to type 'SectionProps'.
- Object literal may only specify known properties, and 'pageTitle' does
not exist in type 'SectionProps'
- pageUrl,toolData,scanResult doesn't exist in type 'SectionProps'.
Hence removed.

9.  **deps:null**

- **Error:** Type '{ [x: string]: string | number | boolean |
JSX.Element; id: string; header: JSX.Element; content: JSX.Element;
headingLevel: number; deps: null; isExpanded: boolean; }' is not
assignable to type 'ReportCollapsibleContainerProps'.
- Object literal may only specify known properties, and 'deps' does not
exist in type 'ReportCollapsibleContainerProps'.
- isExpanded doesn't exist in type 'ReportCollapsibleContainerProps'.
Hence removed.


10.  **{ name: 'Any', key: 'any' }**

- **Error :** Type '{ name: string; key: string; }' is not assignable to
type 'IRequirementSubsetForSummary'.
- Object literal may only specify known properties, and 'key' does not
exist in type 'IRequirementSubsetForSummary'.

11. **cardSelectionMessageCreator**

- **Error:** Type '{ serviceName: string; axeVersion: string; userAgent:
string; browserResolution: string; scanDetails: ScanSummaryDetails;
results: CombinedReportResults; cardSelectionMessageCreator:
CardSelectionMessageCreator; }' is not assignable to type
'CombinedReportParameters'.
- Object literal may only specify known properties, and
'cardSelectionMessageCreator' does not exist in type
'CombinedReportParameters'.


#### Pull request checklist
<!-- If a checklist item is not applicable to this change, write "n/a"
in the checkbox -->
- [x] Addresses an existing issue:
#[[0000](https://github.com/microsoft/accessibility-insights-web/pull/6611)](https://github.com/microsoft/accessibility-insights-web/pull/6611)
- [ ] Ran `yarn fastpass`
- [x] Added/updated relevant unit test(s) (and ran `yarn test`)
- [x] Verified code coverage for the changes made. Check coverage report
at: `<rootDir>/test-results/unit/coverage`
- [ ] PR title *AND* final merge commit title both start with a semantic
tag (`fix:`, `chore:`, `feat(feature-name):`, `refactor:`). See
`CONTRIBUTING.md`.
- [ ] (UI changes only) Added screenshots/GIFs to description above
- [ ] (UI changes only) Verified usability with NVDA/JAWS

---------

Co-authored-by: Madalyn <[email protected]>
  • Loading branch information
JeevaniChinthala and madalynrose authored Apr 11, 2024
1 parent f028ca5 commit 15c1507
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 297 deletions.
1 change: 0 additions & 1 deletion src/popup/components/popup-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export class PopupView extends React.Component<PopupViewProps> {
<AdHocToolsPanel
backLinkHandler={this.openTogglesView}
diagnosticViewToggleFactory={this.props.diagnosticViewToggleFactory}
featureFlagStoreData={this.props.storeState.featureFlagStoreData}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe('InteractiveHeader', () => {
featureFlagStoreData: {
'test-flag': true,
},
avatarUrl: 'avatarUrl',
tabClosed,
deps: {
dropdownClickHandler: dropdownClickHandlerStub,
Expand All @@ -54,10 +53,7 @@ describe('InteractiveHeader', () => {

it.each([false, true])('render: isNavCollapsed equals %s', isNavCollapsed => {
const props: InteractiveHeaderProps = {
dropdownClickHandler: null,
featureFlagStoreData: null,
connected: null,
avatarUrl: null,
tabClosed: false,
deps: null,
selectedPivot: DetailsViewPivotType.assessment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ describe('ManualTestStepView', () => {
const props: ManualTestStepViewProps = {
step: 'step',
test: VisualizationType.HeadingsAssessment,
status: ManualTestStatus.FAIL,
assessmentInstanceTableHandler: assessmentInstanceTableHandlerMock.object,
manualTestStepResultMap: {
step: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ exports[`PopupView render actual content render toggles view: ad-hoc tools 1`] =
featureflags="[object Object]"
title="test title"
/>
<mock-adhoctoolspanel
featureflagstoredata="[object Object]"
/>
<mock-adhoctoolspanel />
</div>
<mock-telemetrypermissiondialog
deps="[object Object]"
Expand Down Expand Up @@ -67,9 +65,7 @@ exports[`PopupView render actual content renderAdHocToolsPanel 1`] = `
featureflags="[object Object]"
title="test title"
/>
<mock-adhoctoolspanel
featureflagstoredata="[object Object]"
/>
<mock-adhoctoolspanel />
</div>
<mock-telemetrypermissiondialog
deps="[object Object]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ describe('FeedbackMenuClickHandlerTest', () => {
deps: deps,
title: 'title',
subtitle: 'subtitle',
supportLinkHandler: null,
popupWindow: null,
featureFlags: null,
openAdhocToolsPanel: null,
dropdownClickHandler: null,
};
const header = new LaunchPanelHeader(props);
header.setState = setStateMock.object;
Expand All @@ -102,10 +100,8 @@ describe('FeedbackMenuClickHandlerTest', () => {
title: 'title',
subtitle: 'subtitle',
openAdhocToolsPanel: openAdhocToolsPanelMock.object,
supportLinkHandler: null,
popupWindow: null,
featureFlags: null,
dropdownClickHandler: null,
};

const header = new LaunchPanelHeader(props);
Expand Down
4 changes: 0 additions & 4 deletions src/tests/unit/tests/popup/main-renderer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { title } from 'content/strings/application';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { IMock, It, Mock } from 'typemoq';
import { BrowserAdapter } from '../../../../common/browser-adapters/browser-adapter';
import { Theme } from '../../../../common/components/theme';
import { DropdownClickHandler } from '../../../../common/dropdown-click-handler';
import { DiagnosticViewToggleFactory } from '../../../../popup/components/diagnostic-view-toggle-factory';
Expand Down Expand Up @@ -34,7 +33,6 @@ describe('MainRenderer', () => {
const renderMock: IMock<typeof ReactDOM.render> = Mock.ofInstance(() => null);

const popupWindowMock = Mock.ofInstance(window);
const browserAdapterMock = Mock.ofType<BrowserAdapter>();
const hasAccess = true;
const targetTabUrl = 'url';

Expand All @@ -56,7 +54,6 @@ describe('MainRenderer', () => {
gettingStartedDialogHandlerMock.object,
launchPanelHeaderClickHandler:
feedbackMenuClickhandlerMock.object,
browserAdapter: browserAdapterMock.object,
}}
popupWindow={popupWindowMock.object}
targetTabUrl={targetTabUrl}
Expand All @@ -80,7 +77,6 @@ describe('MainRenderer', () => {
diagnosticViewClickHandler: diagnosticViewClickHandlerMock.object,
popupViewControllerHandler: gettingStartedDialogHandlerMock.object,
launchPanelHeaderClickHandler: feedbackMenuClickhandlerMock.object,
browserAdapter: browserAdapterMock.object,
},
renderMock.object,
fakeDocument,
Expand Down
Loading

0 comments on commit 15c1507

Please sign in to comment.