-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.js
More file actions
118 lines (113 loc) · 4.18 KB
/
tests.js
File metadata and controls
118 lines (113 loc) · 4.18 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
var hyperpublic = require('../lib/hyperpublic'),
vows = require('vows'),
assert = require('assert'),
util = require('util');
var client_id = 'Y8ccbceyZZbcmNoZ8RsXLHDhxSs0qnL40SmmjRBU',
client_secret = '5YugC5yJYeFgjcfYf0VrzYnsiVJu00TYJBOTd4r2';
var api = new hyperpublic.API(client_id, client_secret);
api.host = 'localhost:3000';
vows.describe('Test Hyperpublic API Wrapper').addBatch({
'While you use the Hyperpublic API': {
'when querying for a person by id' : {
topic: function () {
api.people.show(4, this.callback);
},
'an an object will be returned': function (topic, err) {
assert.isUndefined(topic.error, err);
assert.isObject(topic);
}
},
'when searching for people': {
topic: function () {
api.people.find({
'zipcode' : '11211',
'limit' : '2'
}, this.callback);
},
'an array will be returned': function (topic, err) {
assert.isUndefined(topic.error, err);
assert.isArray(topic);
}
},
'when creating a person': {
topic: function () {
api.people.create({
'email':'jonathanvingiano' + Math.floor(Math.random() * 1000) + '@hyperpublic.com',
'display_name':'Jonathan V',
'password': 'my_password',
'tags': 'test'
}, this.callback);
},
'an object will be returned': function (topic, err) {
assert.isUndefined(topic.error);
assert.isObject(topic);
}
},
'when querying for a place by id': {
topic: function () {
api.places.show(100, this.callback);
},
'an object will be returned': function (topic, err) {
assert.isUndefined(topic.error);
assert.isObject(topic);
}
},
'when searching for places': {
topic: function () {
api.places.find({
'zipcode': '11211',
'limit': '2'
}, this.callback);
},
'an array will be returned': function (topic, err) {
assert.isUndefined(topic.error);
assert.isArray(topic);
}
},
'when creating a place': {
topic: function () {
api.places.create({
'display_name': 'javascript cave'
}, this.callback);
},
'an object will be returned': function (topic, err) {
assert.isUndefined(topic.error);
assert.isObject(topic);
}
},
'when querying for a thing by id': {
topic: function () {
api.things.show(722, this.callback);
},
'an object will be returned': function (topic, err){
assert.isUndefined(topic.error);
assert.isObject(topic);
}
},
'when searching for things': {
topic: function () {
api.things.find({
'zipcode': '11211',
'limit': '2'
}, this.callback);
},
'an array will be returned': function (topic, err) {
assert.isUndefined(topic.error);
assert.isArray(topic);
}
},
'when creating a thing': {
topic: function (){
api.things.create({
'display_name': 'macbook pro',
'tags': 'my expensive paperweight',
'image_url': 'http://developers.hyperpublic.com/images/logo.png'
}, this.callback);
},
'an object will be returned': function (topic, err){
assert.isUndefined(topic.error);
assert.isObject(topic);
}
}
}
}).run();