1 | "use strict";
|
2 | let neows = require('../index.js').neows;
|
3 | let chai = require('chai');
|
4 | let chaiSubset = require('chai-subset');
|
5 | let assert = chai.assert;
|
6 | chai.use(chaiSubset);
|
7 |
|
8 | describe('NeoWs', function() {
|
9 | it('should return json data with no args today', function (done) {
|
10 | neows.today().then(function (data) {
|
11 | assert.containSubset(JSON.parse(data), {
|
12 | near_earth_objects: {}});
|
13 | done();
|
14 | }).catch(done);
|
15 | });
|
16 |
|
17 | it('should return json data with start_date and end_date feed', function (done) {
|
18 | neows.feed("2015-06-03", "2015-06-03").then(function (data) {
|
19 | assert.containSubset(JSON.parse(data), {
|
20 | near_earth_objects: {}});
|
21 | done();
|
22 | }).catch(done);
|
23 | });
|
24 |
|
25 | it('should return json data with no args browse', function (done) {
|
26 | neows.browse().then(function (data) {
|
27 | assert.containSubset(JSON.parse(data), {
|
28 | near_earth_objects: {}});
|
29 | done();
|
30 | }).catch(done);
|
31 | });
|
32 |
|
33 | it('should return json data with no args stats', function (done) {
|
34 | neows.stats().then(function (data) {
|
35 | assert.containSubset(JSON.parse(data), {
|
36 | source: "All the NEO data is from NASA JPL NEO team."});
|
37 | done();
|
38 | }).catch(done);
|
39 | });
|
40 |
|
41 | it('should return json data with id provided lookup', function (done) {
|
42 | neows.lookup(3542519).then(function (data) {
|
43 | assert.containSubset(JSON.parse(data), {
|
44 | links: {}});
|
45 | done();
|
46 | }).catch(done);
|
47 | });
|
48 | }); |
\ | No newline at end of file |