forked from PSeitz/yamaha-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmochatest.js
More file actions
184 lines (137 loc) · 5.62 KB
/
Copy pathmochatest.js
File metadata and controls
184 lines (137 loc) · 5.62 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
var chai = require('chai');
var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
var expect = require('chai').expect;
var Yamaha = require("./yamaha.js");
var yamaha_ip= process.argv[4] || "192.168.0.25";
// Tests For Yamaha RV-775
describe('Yamaha-API', function() {
this.timeout(5000);
it('should create a yamaha object', function() {
var yamaha = new Yamaha(yamaha_ip);
});
it('should be turned on', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.powerOn().then(function(){
return yamaha.isOn();
})).to.eventually.be.true;
});
it('should be double turned on', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.powerOn().then(function(){
return yamaha.isOn();
})).to.eventually.be.true;
});
it('should return 16 Inputs', function() {
var yamaha = new Yamaha(yamaha_ip);
return expect(yamaha.getAvailableInputs()).to.eventually.have.length(16);
});
it('should set volume to -600', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.setVolume(-600).then(function(on){
return yamaha.getVolume();
})).to.eventually.equal(-600);
});
it('should increase volume by 100', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.volumeUp(100).then(function(on){
return yamaha.getVolume();
})).to.eventually.equal(-500);;
});
// it('should switch to the webradio favorites using the chained command', function() {
// var yamaha = new Yamaha(yamaha_ip, 0.5);
// yamaha.switchToFavoriteNumber(1).then(function(result){
// yamaha.getCurrentInput().then(function(result){
// expect(result).to.equal("NET RADIO");
// });
// }.to.eventually.be.false);
// });
it('should switch to HDMI2', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.setMainInputTo("HDMI2").then(function() {
return yamaha.getCurrentInput();
})).to.eventually.equal("HDMI2");
});
it('should switch to NET RADIO', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.setMainInputTo("NET RADIO").then(function() {
return yamaha.getCurrentInput();
})).to.eventually.equal("NET RADIO");
});
it('should switch to the webradio favorites and wait to be ready', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.whenMenuReady("NET_RADIO").then(function(result){
return yamaha.selectWebRadioListItem(1).then(function(inputs){
return yamaha.whenMenuReady("NET_RADIO");
});
})).to.eventually.be.true;
});
it('should switch to partey mode on', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.partyModeOn().then(function(on){
return yamaha.isPartyModeEnabled();
})).to.eventually.be.true;
});
it('should switch to partey mode off', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.partyModeOff().then(function(on){
return yamaha.isPartyModeEnabled();
})).to.eventually.be.false;
});
it('should mute main_zone', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.muteOn().then(function(on){
return yamaha.isMuted();
})).to.eventually.be.true;
});
it('should unmute main_zone', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.muteOff().then(function(on){
return yamaha.isMuted();
})).to.eventually.be.false;
});
it('should turn on zone 2', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.powerOn(2).then(function(){
return yamaha.isOn(2);
})).to.eventually.be.true;
});
it('should mute zone 2', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.muteOn(2).then(function(on){
return yamaha.isMuted(2);
})).to.eventually.be.true;
});
it('should still have main zone unmuted', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.isMuted()).to.eventually.be.false;
});
it('should unmute zone 2', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.muteOff(2).then(function(on){
return yamaha.isMuted(2);
})).to.eventually.be.false;
});
it('should be turn off zone 2', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.powerOff(2).then(function(on){
return yamaha.isOn(2);
})).to.eventually.be.false;
});
it('should be turned off', function() {
var yamaha = new Yamaha(yamaha_ip, 0.5);
return expect(yamaha.powerOff().then(function(on){
return yamaha.isOn();
})).to.eventually.be.false;
});
// it('should list the webradio favorites list info', function() {
// var yamaha = new Yamaha(yamaha_ip, 0.5);
// return yamaha.whenMenuReady("NET_RADIO").then(function(result){
// return yamaha.selectWebRadioListItem(1).then(function(inputs){
// return yamaha.whenMenuReady("NET_RADIO").then(function(result){
// expect(result).to.be.true;
// });
// }.to.eventually.be.false);
// });
// });
});