Skip to content

Commit

Permalink
test: add catch block to muted test
Browse files Browse the repository at this point in the history
  • Loading branch information
SivanA-Kaltura committed Apr 13, 2022
1 parent ae2798a commit c63c5d7
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions test/src/common/storage/storage-manager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,29 @@ describe('StorageManager', function () {
it('should set muted to true/false depends on changed volume', function (done) {
StorageWrapper._testForLocalStorage = () => (StorageWrapper._isLocalStorageAvailable = true);
player = setup(config);
player.loadMedia({entryId: entryId}).then(() => {
try {
player.muted = true;
player.dispatchEvent(new FakeEvent(player.Event.UI.USER_CLICKED_MUTE));
StorageManager.getStorageConfig().playback.muted.should.be.true;
player.volume = 0.5;
player.dispatchEvent(new FakeEvent(player.Event.UI.USER_CHANGED_VOLUME));
StorageManager.getStorageConfig().playback.muted.should.be.false;
StorageManager.getStorageConfig().playback.volume.should.equals(0.5);
player.volume = 0;
player.dispatchEvent(new FakeEvent(player.Event.UI.USER_CHANGED_VOLUME));
StorageManager.getStorageConfig().playback.muted.should.be.true;
StorageManager.getStorageConfig().playback.volume.should.equals(0);
done();
} catch (err) {
player
.loadMedia({entryId: entryId})
.then(() => {
try {
player.muted = true;
player.dispatchEvent(new FakeEvent(player.Event.UI.USER_CLICKED_MUTE));
StorageManager.getStorageConfig().playback.muted.should.be.true;
player.volume = 0.5;
player.dispatchEvent(new FakeEvent(player.Event.UI.USER_CHANGED_VOLUME));
StorageManager.getStorageConfig().playback.muted.should.be.false;
StorageManager.getStorageConfig().playback.volume.should.equals(0.5);
player.volume = 0;
player.dispatchEvent(new FakeEvent(player.Event.UI.USER_CHANGED_VOLUME));
StorageManager.getStorageConfig().playback.muted.should.be.true;
StorageManager.getStorageConfig().playback.volume.should.equals(0);
done();
} catch (err) {
done(err);
}
})
.catch(err => {
done(err);
}
});
});
});

it('should set textStyle of player with textStyle from local storage', function () {
Expand Down

0 comments on commit c63c5d7

Please sign in to comment.