UNPKG

1.9 kBJavaScriptView Raw
1"use strict";
2let eonet = require('../index.js').eonet;
3let chai = require('chai');
4let assert = chai.assert;
5
6describe('EONET', function() {
7 it('should return json with no args events endpoint', function(done) {
8 eonet.events().then(function(data) {
9 assert.containSubset(JSON.parse(data), {description: "Natural events from EONET."});
10 done()
11 })
12 .catch(done);
13
14 });
15 it('should return json with full args events endpoint', function(done) {
16 eonet.events({source: "InciWeb,EO",status: "closed",limit: 5, days:25}).then(function(data) {
17 assert.containSubset(JSON.parse(data), {description: "Natural events from EONET."});
18 done()
19 })
20 .catch(done);
21
22 });
23 it('should return json with no args categories endpoint', function(done) {
24 eonet.categories()
25 .then(function(data){
26 assert.containSubset(JSON.parse(data), {title: "EONET Event Categories"});
27 done();
28
29 }).catch(done);
30
31 });
32 it('should return json with full args categories endpoint', function(done) {
33 eonet.categories({id:8, source: "InciWeb,EO",status: "open",limit: 5, days:25})
34 .then(function(data){
35 assert.containSubset(JSON.parse(data), {description: "Wildfires includes all nature of fire, including forest and plains fires, as well as urban and industrial fire events. Fires may be naturally caused or manmade."});
36 done();
37
38 }).catch(done);
39
40 });
41
42 it('should return json with id provided layers endpoint', function(done) {
43 eonet.layers(8)
44 .then(function(data){
45 assert.containSubset(JSON.parse(data), {title: "EONET Web Service Layers"});
46 done();
47
48 }).catch(done);
49
50 });
51});
\No newline at end of file