mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-11 18:44:07 +00:00
WA-238 Added a test for assuring grantedSelector works in a case-insentive mode
This commit is contained in:
parent
4caacdb184
commit
8e908bb5fc
@ -30,7 +30,7 @@ export const grantedSelector: Selector<GlobalState, RouterProps, boolean> = crea
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return owners.find((owner: Owner) => owner.get('address') === userAccount) !== undefined
|
return owners.find((owner: Owner) => owner.get('address').toLocaleLowerCase() === userAccount.toLocaleLowerCase()) !== undefined
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ const grantedSelectorTests = () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('Safe Selector[grantedSelector]', () => {
|
describe('Safe Selector[grantedSelector]', () => {
|
||||||
it('should be granted to operate when a safe when the user is owner', () => {
|
it('should be granted to operate a safe when the user is owner', () => {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
let map: Map<string, Safe> = Map()
|
let map: Map<string, Safe> = Map()
|
||||||
map = map.set('fooAddress', SafeFactory.oneOwnerSafe(provider.account))
|
map = map.set('fooAddress', SafeFactory.oneOwnerSafe(provider.account))
|
||||||
@ -37,6 +37,27 @@ const grantedSelectorTests = () => {
|
|||||||
expect(granted).toBe(true)
|
expect(granted).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should be granted to operate a safe when the user is owner in case-insensitive', () => {
|
||||||
|
// GIVEN
|
||||||
|
let map: Map<string, Safe> = Map()
|
||||||
|
map = map.set('fooAddress', SafeFactory.oneOwnerSafe(provider.account.toUpperCase()))
|
||||||
|
|
||||||
|
const match: Match = buildMathPropsFrom('fooAddress')
|
||||||
|
|
||||||
|
const reduxStore = {
|
||||||
|
[SAFE_REDUCER_ID]: map,
|
||||||
|
providers: makeProvider(provider),
|
||||||
|
balances: undefined,
|
||||||
|
transactions: undefined,
|
||||||
|
}
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
const granted = grantedSelector(reduxStore, { match })
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
expect(granted).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
it('should NOT be granted to operate with a Safe when the user is NOT owner', () => {
|
it('should NOT be granted to operate with a Safe when the user is NOT owner', () => {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
let map: Map<string, Safe> = Map()
|
let map: Map<string, Safe> = Map()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user