This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1047 from nickgros/context
- Loading branch information
Showing
196 changed files
with
3,678 additions
and
2,734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
import { mount } from 'enzyme' | ||
import * as React from 'react' | ||
import DirectDownload, { DirectFileDownloadProps } from '../../../lib/containers/DirectDownload' | ||
import DirectDownload, { | ||
DirectFileDownloadProps, | ||
} from '../../../lib/containers/DirectDownload' | ||
import { act } from '@testing-library/react' | ||
import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils'; | ||
import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' | ||
import { SynapseTestContext } from '../../../mocks/MockSynapseContext' | ||
|
||
describe('DirectDownload: basic functionality', () => { | ||
|
||
const props:DirectFileDownloadProps = { | ||
token: '123', | ||
const props: DirectFileDownloadProps = { | ||
associatedObjectId: 'abc', | ||
entityVersionNumber: '345' | ||
entityVersionNumber: '345', | ||
} | ||
|
||
it('render direct download component without crashing', async () => { | ||
const wrapper = mount(<DirectDownload {...props} />) | ||
mockAllIsIntersecting(true); | ||
const wrapper = mount(<DirectDownload {...props} />, { | ||
wrappingComponent: SynapseTestContext, | ||
}) | ||
mockAllIsIntersecting(true) | ||
expect(wrapper).toBeDefined() | ||
}) | ||
|
||
it('file handle fetch failure should display nothing', async () => { | ||
await act(async () => { | ||
const wrapper = await mount(<DirectDownload {...props} />) | ||
mockAllIsIntersecting(true); | ||
const wrapper = await mount(<DirectDownload {...props} />, { | ||
wrappingComponent: SynapseTestContext, | ||
}) | ||
mockAllIsIntersecting(true) | ||
expect(wrapper.children()).toEqual({}) | ||
}) | ||
}) | ||
|
||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,38 @@ | ||
import * as React from 'react' | ||
import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' | ||
import EntityIdList, { EntityIdListProps } from '../../../lib/containers/EntityIdList' | ||
import EntityIdList, { | ||
EntityIdListProps, | ||
} from '../../../lib/containers/EntityIdList' | ||
import { mount } from 'enzyme' | ||
import { act } from 'react-dom/test-utils' | ||
import { SynapseTestContext } from '../../../mocks/MockSynapseContext' | ||
|
||
describe('EntityIdList: basic functionality', () => { | ||
|
||
const props:EntityIdListProps = { | ||
token: '123', | ||
entityIdList: ['syn123', 'syn345'] | ||
const props: EntityIdListProps = { | ||
entityIdList: ['syn123', 'syn345'], | ||
} | ||
|
||
it('render direct download component without crashing', async () => { | ||
const wrapper = mount(<EntityIdList {...props} />) | ||
mockAllIsIntersecting(true); | ||
const wrapper = mount(<EntityIdList {...props} />, { | ||
wrappingComponent: SynapseTestContext, | ||
}) | ||
mockAllIsIntersecting(true) | ||
expect(wrapper).toBeDefined() | ||
}) | ||
|
||
it('test', async () => { | ||
const setEntityNameList = jest.fn() | ||
const handleStateChange = jest.spyOn(React, "useState") | ||
handleStateChange.mockImplementation(entityNameList => [entityNameList, setEntityNameList]); | ||
const handleStateChange = jest.spyOn(React, 'useState') | ||
handleStateChange.mockImplementation(entityNameList => [ | ||
entityNameList, | ||
setEntityNameList, | ||
]) | ||
act(() => { | ||
mount(<EntityIdList {...props} />) | ||
mockAllIsIntersecting(true); | ||
mount(<EntityIdList {...props} />, { | ||
wrappingComponent: SynapseTestContext, | ||
}) | ||
mockAllIsIntersecting(true) | ||
}) | ||
expect(handleStateChange).toBeCalled() | ||
}) | ||
|
||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.