From 105eb953919291939caddd715478603cae6df03c Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Mon, 26 Feb 2018 12:24:29 -0500 Subject: [PATCH] Add tests for `Settings.shouldShowAudioNotificationSetting` --- test/modules/types/settings_test.js | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/modules/types/settings_test.js diff --git a/test/modules/types/settings_test.js b/test/modules/types/settings_test.js new file mode 100644 index 000000000..36c1afb06 --- /dev/null +++ b/test/modules/types/settings_test.js @@ -0,0 +1,53 @@ +const sinon = require('sinon'); +const { assert } = require('chai'); + +const Settings = require('../../../js/modules/types/settings'); + + +describe('Settings', () => { + const sandbox = sinon.createSandbox(); + + describe('shouldShowAudioNotificationSetting', () => { + context('on macOS', () => { + beforeEach(() => { + sandbox.stub(process, 'platform').value('darwin'); + }); + + afterEach(() => { + sandbox.restore(); + }); + + it('should return true', () => { + assert.isTrue(Settings.shouldShowAudioNotificationSetting()); + }); + }); + + context('on Windows', () => { + beforeEach(() => { + sandbox.stub(process, 'platform').value('win32'); + }); + + afterEach(() => { + sandbox.restore(); + }); + + it('should return true', () => { + assert.isTrue(Settings.shouldShowAudioNotificationSetting()); + }); + }); + + context('on Linux', () => { + beforeEach(() => { + sandbox.stub(process, 'platform').value('linux'); + }); + + afterEach(() => { + sandbox.restore(); + }); + + it('should return false', () => { + assert.isFalse(Settings.shouldShowAudioNotificationSetting()); + }); + }); + }); +});