-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
38 lines (30 loc) · 1010 Bytes
/
test.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
/*
You must code your test on this File.
You are able to create more test files or folders,
but you should change the "test" script in package.json
in order to running the test with the "npm test" command.
*/
/*
Here there are some GET and POST request that you can use for testing your code.
For testing the plugin you should intalled into the dashboard. You can do it through
1. The user interface of the dashboard
2. Command line, by copying your folder to dashboard/.sandbox/NAME_PLUGIN
*/
var request = require('request')
var argspost = {power: 1, brightness: 100, color: '#000055'}
request.post({
url: 'http://localhost/i/philips-hue/hueLights/1',
json: argspost
}, function (err, resp, body) {
console.log(err)
console.log(body)
})
var argsget = {power: '', brightness: ''}
request.get({
url: 'http://localhost/i/philips-hue/hueLights/1',
qs: argsget
}, function (err, resp, body) {
console.log(err)
console.log(body)
})
// url: http://IP/i/NAME_PLUGIN/HOOK/id