From 83bbfbe0270e1fe33284364f7be40bb05114fd11 Mon Sep 17 00:00:00 2001 From: Kelsey Pownell Date: Fri, 15 May 2020 12:34:53 -0700 Subject: [PATCH] remove update-handler from ReflowAssessmentView --- .../components/reflow-assessment-view.tsx | 24 +--------- .../reflow-assessment-view.test.tsx.snap | 8 +--- .../reflow-assessment-view.test.tsx | 44 +------------------ 3 files changed, 5 insertions(+), 71 deletions(-) diff --git a/src/DetailsView/components/reflow-assessment-view.tsx b/src/DetailsView/components/reflow-assessment-view.tsx index 5d08ef3f14a..8137b99478d 100644 --- a/src/DetailsView/components/reflow-assessment-view.tsx +++ b/src/DetailsView/components/reflow-assessment-view.tsx @@ -2,11 +2,6 @@ // Licensed under the MIT License. import * as React from 'react'; -import { - AssessmentViewUpdateHandler, - AssessmentViewUpdateHandlerDeps, - AssessmentViewUpdateHandlerProps, -} from 'DetailsView/components/assessment-view-update-handler'; import { AssessmentTestResult } from '../../common/assessment/assessment-test-result'; import { Tab } from '../../common/itab'; import { @@ -17,10 +12,7 @@ import { import { GettingStartedView } from './getting-started-view'; import { TargetChangeDialog, TargetChangeDialogDeps } from './target-change-dialog'; -export type ReflowAssessmentViewDeps = { - assessmentViewUpdateHandler: AssessmentViewUpdateHandler; -} & AssessmentViewUpdateHandlerDeps & - TargetChangeDialogDeps; +export type ReflowAssessmentViewDeps = TargetChangeDialogDeps; export type ReflowAssessmentViewProps = { deps: ReflowAssessmentViewDeps; @@ -29,7 +21,7 @@ export type ReflowAssessmentViewProps = { currentTarget: Tab; prevTarget: PersistedTabInfo; assessmentTestResult: AssessmentTestResult; -} & AssessmentViewUpdateHandlerProps; +}; export class ReflowAssessmentView extends React.Component { public render(): JSX.Element { @@ -47,18 +39,6 @@ export class ReflowAssessmentView extends React.Component { - let updateHandlerMock: IMock; - - beforeEach(() => { - updateHandlerMock = Mock.ofType(AssessmentViewUpdateHandler); - }); - test('render for requirement', () => { const props = generateProps('requirement'); const rendered = shallow(); @@ -32,37 +25,6 @@ describe('AssessmentViewTest', () => { expect(rendered.getElement()).toMatchSnapshot(); }); - test('componentDidMount', () => { - const props = generateProps('requirement'); - updateHandlerMock.setup(u => u.onMount(props)).verifiable(Times.once()); - const testObject = new ReflowAssessmentView(props); - - testObject.componentDidMount(); - - updateHandlerMock.verifyAll(); - }); - - test('componentWillUnmount', () => { - const props = generateProps('requirement'); - updateHandlerMock.setup(u => u.onUnmount(props)).verifiable(Times.once()); - const testObject = new ReflowAssessmentView(props); - - testObject.componentWillUnmount(); - - updateHandlerMock.verifyAll(); - }); - - test('componentDidUpdate', () => { - const prevProps = generateProps('requirement1'); - const props = generateProps('requirement2'); - updateHandlerMock.setup(u => u.update(prevProps, props)).verifiable(Times.once()); - const testObject = new ReflowAssessmentView(props); - - testObject.componentDidUpdate(prevProps); - - updateHandlerMock.verifyAll(); - }); - function generateProps(subview: string): ReflowAssessmentViewProps { const assessmentDataMock = Mock.ofType(); @@ -73,9 +35,7 @@ describe('AssessmentViewTest', () => { } as AssessmentTestResult; const reflowProps = { - deps: { - assessmentViewUpdateHandler: updateHandlerMock.object, - } as ReflowAssessmentViewDeps, + deps: {} as ReflowAssessmentViewDeps, prevTarget: { id: 4 }, currentTarget: { id: 5 }, assessmentNavState: {