-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic test to ensure container completeness
- Loading branch information
1 parent
ccd1aba
commit 553efd0
Showing
2 changed files
with
51 additions
and
2 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
49 changes: 49 additions & 0 deletions
49
ui/app/pages/settings/advanced-tab/tests/advanced-tab-container.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,49 @@ | ||
import React from 'react' | ||
import assert from 'assert' | ||
import sinon from 'sinon' | ||
import { mount } from 'enzyme' | ||
import { mapStateToProps, mapDispatchToProps } from '../advanced-tab.container' | ||
|
||
const defaultState = { | ||
appState: { | ||
warning: null, | ||
}, | ||
metamask: { | ||
featureFlags: { | ||
sendHexData: false, | ||
advancedInlineGas: false, | ||
}, | ||
preferences: { | ||
autoLogoutTimeLimit: 0, | ||
showFiatInTestnets: false, | ||
useNativeCurrencyAsPrimaryCurrency: true, | ||
}, | ||
}, | ||
} | ||
|
||
describe('AdvancedTab Container', () => { | ||
it('should map state to props correctly', () => { | ||
const props = mapStateToProps(defaultState) | ||
const expected = { | ||
warning: null, | ||
sendHexData: false, | ||
advancedInlineGas: false, | ||
showFiatInTestnets: false, | ||
autoLogoutTimeLimit: 0, | ||
} | ||
|
||
assert.deepEqual(props, expected) | ||
}) | ||
|
||
it('should map dispatch to props correctly', () => { | ||
const props = mapDispatchToProps(() => 'mockDispatch') | ||
|
||
assert.ok(typeof props.setHexDataFeatureFlag === 'function') | ||
assert.ok(typeof props.setRpcTarget === 'function') | ||
assert.ok(typeof props.displayWarning === 'function') | ||
assert.ok(typeof props.showResetAccountConfirmationModal === 'function') | ||
assert.ok(typeof props.setAdvancedInlineGasFeatureFlag === 'function') | ||
assert.ok(typeof props.setShowFiatConversionOnTestnetsPreference === 'function') | ||
assert.ok(typeof props.setAutoLogoutTimeLimit === 'function') | ||
}) | ||
}) |