-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d79e71
commit 38b660f
Showing
2 changed files
with
56 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
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,51 @@ | ||
import { | ||
requirePasscode as requirePasscodeReducer, | ||
passcodeHash as passcodeHashReducer, | ||
togglePasscodeRequirement, | ||
resetPasscodeSettings, | ||
setPasscode, | ||
} from './settings'; | ||
|
||
describe('settings modules test', () => { | ||
describe('requirePasscode reducer test', () => { | ||
it('should return the initial state', () => { | ||
expect(requirePasscodeReducer(undefined, {})).toEqual(false); | ||
}); | ||
|
||
it('should set the requirement to false if previously true', () => { | ||
expect(requirePasscodeReducer(true, togglePasscodeRequirement())).toEqual( | ||
false | ||
); | ||
}); | ||
|
||
it('should set the requirement to true if previously false', () => { | ||
expect( | ||
requirePasscodeReducer(false, togglePasscodeRequirement()) | ||
).toEqual(true); | ||
}); | ||
|
||
it('should reset the requirement correctly (reset to initial state)', () => { | ||
expect(requirePasscodeReducer(true, resetPasscodeSettings())).toEqual( | ||
false | ||
); | ||
}); | ||
}); | ||
|
||
describe('passcodeHash reducer test', () => { | ||
it('should return the initial state', () => { | ||
expect(passcodeHashReducer(undefined, {})).toEqual(null); | ||
}); | ||
|
||
it('should set the hash correctly', () => { | ||
expect( | ||
passcodeHashReducer(undefined, setPasscode('HASH HASH BABY')) | ||
).toEqual('HASH HASH BABY'); | ||
}); | ||
|
||
it('should reset passcode hash correctly (reset to initial state)', () => { | ||
expect( | ||
passcodeHashReducer('HASH HASH BABY', resetPasscodeSettings()) | ||
).toEqual(null); | ||
}); | ||
}); | ||
}); |