Port Settings
and OS
to TypeScript
This commit is contained in:
parent
38b23c6627
commit
a102016ed8
6 changed files with 36 additions and 23 deletions
56
ts/test/types/Settings_test.ts
Normal file
56
ts/test/types/Settings_test.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
import os from 'os';
|
||||
import sinon from 'sinon';
|
||||
import { assert } from 'chai';
|
||||
|
||||
import * as Settings from '../../../ts/types/Settings';
|
||||
|
||||
describe('Settings', () => {
|
||||
const sandbox = sinon.createSandbox();
|
||||
|
||||
describe('isAudioNotificationSupported', () => {
|
||||
context('on macOS', () => {
|
||||
beforeEach(() => {
|
||||
sandbox.stub(process, 'platform').value('darwin');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
it('should return true', () => {
|
||||
assert.isTrue(Settings.isAudioNotificationSupported());
|
||||
});
|
||||
});
|
||||
|
||||
context('on Windows', () => {
|
||||
context('version 8+', () => {
|
||||
beforeEach(() => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('8.0.0');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
it('should return true', () => {
|
||||
assert.isTrue(Settings.isAudioNotificationSupported());
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
context('on Linux', () => {
|
||||
beforeEach(() => {
|
||||
sandbox.stub(process, 'platform').value('linux');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
it('should return false', () => {
|
||||
assert.isFalse(Settings.isAudioNotificationSupported());
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue