mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
fix: don't throw if state percentage is zero (#536)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This commit is contained in:
parent
74d436f4f5
commit
3bf712b592
@ -133,7 +133,7 @@ const storeReducer = (state, action) => {
|
||||
throw new Error(`Invalid state type: ${action.data.type}`);
|
||||
}
|
||||
|
||||
if (!action.data.percentage) {
|
||||
if (_.isUndefined(action.data.percentage) || _.isNull(action.data.percentage)) {
|
||||
throw new Error('Missing state percentage');
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,18 @@ describe('Browser: ImageWriter', function() {
|
||||
}).to.throw('Invalid state type: 1234');
|
||||
});
|
||||
|
||||
it('should not throw if percentage is 0', function() {
|
||||
ImageWriterService.setFlashingFlag();
|
||||
m.chai.expect(function() {
|
||||
ImageWriterService.setProgressState({
|
||||
type: 'write',
|
||||
percentage: 0,
|
||||
eta: 15,
|
||||
speed: 100000000000
|
||||
});
|
||||
}).to.not.throw('Missing state percentage');
|
||||
});
|
||||
|
||||
it('should throw if percentage is missing', function() {
|
||||
ImageWriterService.setFlashingFlag();
|
||||
m.chai.expect(function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user