forked from TheThingSystem/node-winkapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
101 lines (87 loc) · 2.08 KB
/
Copy pathtest.js
File metadata and controls
101 lines (87 loc) · 2.08 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
var WinkAPI = require('./winkapi');
var configFile = {};
try{
configFile = require('./config.json')
}
catch(e){
console.log('could not load config via config.json, using environment properties instead');
}
var config = {
clientID : configFile.clientID || process.env.clientID,
clientSecret : configFile.clientSecret || process.env.clientSecret,
userName : configFile.userName || process.env.userName,
passPhrase : configFile.passPhrase || process.env.passPhrase,
//logger:{ }
};
describe('Test Wink API Client', function() {
this.timeout(5000);
function setup(callback){
var winky = new WinkAPI.WinkAPI(config);
winky.login(config.userName, config.passPhrase, callback)
.on('error', function(err) {
console.log('background error: ' + err.message);
});
}
it('login', function(done){
setup(function(err){
if(err){
throw new Error(err);
}
done();
})
});
it('get users', function(done){
setup(function(err, winkapi) {
winkapi.getUser(done);
});
});
it('get devices', function(done){
setup(function(err, winkapi){
winkapi.getDevices(function(){
done();
});
});
});
it('get icons', function(done){
setup(function(err, winkapi){
winkapi.getIcons(function(){
done();
});
});
});
it('get channels', function(done){
setup(function(err, winkapi){
winkapi.getChannels(function(){
done();
});
});
});
it('get dial templates', function(done){
setup(function(err, winkapi){
winkapi.getDialTemplates(function(){
done();
});
});
});
it('get services', function(done){
setup(function(err, winkapi){
winkapi.getServices(function(){
done();
});
});
});
it('get scenes', function(done){
setup(function(err, winkapi){
winkapi.getScenes(function(){
done();
});
});
});
it('get robots', function(done){
setup(function(err, winkapi){
winkapi.getRobots(function(){
done();
});
});
});
});