-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more test for asset group component
CSRF token mocked for tests preparation (at tests_helper init)
- Loading branch information
Showing
14 changed files
with
150 additions
and
32 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
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
34 changes: 34 additions & 0 deletions
34
test/javascript/components/asset_group_components/asset_group.test.js
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React, {Fragment} from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { shallow, mount } from 'enzyme'; | ||
|
||
import '../../test_helpers/test_init' | ||
|
||
import { buildAssetGroupData } from '../../test_helpers/factories' | ||
|
||
import AssetGroup from 'asset_group_components/asset_group'; | ||
|
||
const NUM_ASSETS = 3 | ||
|
||
describe('AssetGroup', () => { | ||
const stateAssetGroup = { | ||
assetGroup: buildAssetGroupData(1,NUM_ASSETS), | ||
activityRunning: false, | ||
isShown: false, | ||
uuidsPendingRemoval: [], | ||
dataAssetDisplay: {}, | ||
onCollapseFacts: null, | ||
collapsedFacts: {}, | ||
onRemoveAssetFromAssetGroup: null, | ||
onRemoveAllAssetsFromAssetGroup: null, | ||
onErrorMessage: null, | ||
onChangeAssetGroup: null, | ||
onAddBarcodesToAssetGroup: null | ||
} | ||
|
||
|
||
it('renders the assets from the group', () => { | ||
const wrapper = shallow(<AssetGroup {...stateAssetGroup} />); | ||
expect(wrapper.find('AssetDisplay')).toHaveLength(NUM_ASSETS); | ||
}) | ||
}) |
42 changes: 42 additions & 0 deletions
42
test/javascript/components/asset_group_components/asset_group_editor.test.js
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React, {Fragment} from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { shallow, mount } from 'enzyme'; | ||
|
||
import '../../test_helpers/test_init' | ||
|
||
import { buildAssetGroupData } from '../../test_helpers/factories' | ||
|
||
import AssetGroupEditor from 'asset_group_components/asset_group_editor'; | ||
|
||
describe('AssetGroupEditor', () => { | ||
const stateAssetGroup = { | ||
assetGroup: buildAssetGroupData(1,3), | ||
activityRunning: false, | ||
isShown: false, | ||
uuidsPendingRemoval: [], | ||
dataAssetDisplay: {}, | ||
onCollapseFacts: null, | ||
collapsedFacts: {}, | ||
onRemoveAssetFromAssetGroup: null, | ||
onRemoveAllAssetsFromAssetGroup: null, | ||
onErrorMessage: null, | ||
onChangeAssetGroup: null, | ||
onAddBarcodesToAssetGroup: null | ||
} | ||
|
||
it('renders AssetGroupEditor component', () => { | ||
const wrapper = shallow(<AssetGroupEditor {...stateAssetGroup} />); | ||
expect(wrapper.find('BarcodeReader')).toHaveLength(1); | ||
}); | ||
|
||
it('renders <AssetGroup />', () => { | ||
const wrapper = mount(<AssetGroupEditor {...stateAssetGroup} />); | ||
expect(wrapper.find('AssetGroup')).toHaveLength(1); | ||
}) | ||
|
||
it('renders <BarcodeReader />', () => { | ||
const wrapper = mount(<AssetGroupEditor {...stateAssetGroup} />); | ||
expect(wrapper.find('BarcodeReader')).toHaveLength(1); | ||
}) | ||
|
||
}) |
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