-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathbasics.js
35 lines (28 loc) · 796 Bytes
/
basics.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* eslint-env mocha */
const loudness = require('../')
const assert = require('assert')
describe('loudness', () => {
let systemVolume, isMuted
before(async () => {
await Promise.all([
loudness.getVolume().then(v => { systemVolume = v }),
loudness.getMuted().then(m => { isMuted = m })
])
})
after(async () => {
await Promise.all([
loudness.setVolume(systemVolume),
loudness.setMuted(isMuted)
])
})
it('should set and get the volume', async () => {
await loudness.setVolume(15)
const vol = await loudness.getVolume()
assert.strictEqual(vol, 15)
})
it('should set and get the mute state', async () => {
await loudness.setMuted(true)
const mute = await loudness.getMuted()
assert.strictEqual(mute, true)
})
})