-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.js
executable file
·42 lines (34 loc) · 1.09 KB
/
tests.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
36
37
38
39
40
41
42
(function(scope) {
if (!scope.runTests) {
return;
}
function mockSource(source, id, label, type, value) {
//console.log('dispatching', source, id, label, type, value)
var data = {
id: id,
label: label,
type: type,
value: value
};
if (type == 'stream') {
setInterval(function() {
data.value = randomIntInRange(0, 30);
publish(source, data);
}, 1000);
}
else {
publish(source, data);
}
}
var mockSources = [
['source-power', 'batteryCharging', 'Charging', 'scalar', true],
['source-sound', 'avgVolume', 'Average Volume', 'stream', null],
['source-sound', 'unexpectedNoise', 'Unexpected Noise', 'scalar', 'I heard something after a long silence.'],
['source-bluetooth-devices', 'bluetoothDevice', 'Bluetooth Device', 'row', 'Joe\'s iPhone'],
['source-bluetooth-devices', 'bluetoothDevice', 'Bluetooth Device', 'row', 'Amazon Echo'],
['source-power', 'batteryCharging', 'Charging', 'scalar', false]
];
mockSources.forEach(function(s) {
mockSource.apply(null, s);
});
})(this);