1 | var assert = require("assert"),
|
2 | should = require("chai").should(),
|
3 | config = require("../demo/config"),
|
4 | uber = require("../uber")( { server_token: config.token, version: 'v1'}),
|
5 | sLat = 36.3018,
|
6 | sLon = -94.1215,
|
7 | eLat = 36.0,
|
8 | eLon = -94.0;
|
9 |
|
10 |
|
11 | describe("uber-api", function() {
|
12 | describe(".getProducts", function() {
|
13 | it("Should return a list of available products based on location (latitude and longitude).", function(done) {
|
14 | uber.getProducts({ lat : sLat, lng : sLon}, function(error, response) {
|
15 | try {
|
16 | should.not.exist(error);
|
17 | should.exist(response);
|
18 | response.should.be.an('object');
|
19 | done();
|
20 | } catch (e) {
|
21 | done(e);
|
22 | }
|
23 | });
|
24 | });
|
25 | });
|
26 | describe(".getPriceEstimate", function() {
|
27 | it("Should return a JSON object of an array of price estimates based on starting and ending points.", function(done) {
|
28 | uber.getPriceEstimate({sLat: sLat, sLng: sLon, eLat: eLat, eLng: eLon}, function(error, response) {
|
29 | try {
|
30 | should.not.exist(error);
|
31 | should.exist(response);
|
32 | response.should.be.an('object');
|
33 | done();
|
34 | } catch (e) {
|
35 | done(e);
|
36 | }
|
37 | });
|
38 | });
|
39 | });
|
40 | describe(".getTimeEstimate", function() {
|
41 | it("Should return a JSON object of an array of time estimates based on starting point.", function(done) {
|
42 | uber.getTimeEstimate({sLat: sLat, sLng: sLon }, function(error, response) {
|
43 | try {
|
44 | should.not.exist(error);
|
45 | should.exist(response);
|
46 | response.should.be.an('object');
|
47 | done();
|
48 | } catch (e) {
|
49 | done(e);
|
50 | }
|
51 | });
|
52 | });
|
53 | });
|
54 | describe(".getPromotions", function() {
|
55 | it("Should return a JSON object of an array of promotions available to a new user based on location.", function(done) {
|
56 | uber.getPromotions({sLat: sLat, sLng: sLon, eLat: eLat, eLng: eLon}, function(error, response) {
|
57 | try {
|
58 | should.not.exist(error);
|
59 | should.exist(response);
|
60 | response.should.be.an('object');
|
61 | done();
|
62 | } catch (e) {
|
63 | done(e);
|
64 | }
|
65 | });
|
66 | });
|
67 | });
|
68 | }); |
\ | No newline at end of file |