Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

climate-data-crawler

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

climate-data-crawler - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

5

cdoDataCrawler.js

@@ -11,3 +11,3 @@ "use strict";

var queryLocationId;
var index = offset;
var index = 0;

@@ -25,3 +25,3 @@ var resultsDelegate = function(){};

if (index < locations.length && index < count) {
var queryLocation = locations[index];
var queryLocation = locations[index + offset];
queryLocationId = queryLocation.id;

@@ -35,2 +35,3 @@ var probingBounds =

dataQuery.run(onQueryComplete);
index++;

@@ -37,0 +38,0 @@ } else {

2

package.json
{
"name": "climate-data-crawler",
"version": "1.0.1",
"version": "1.0.2",
"description": "Data Crawler for CDO (Climate Data Online) web services",

@@ -5,0 +5,0 @@ "main": "app.js",

@@ -22,4 +22,4 @@ "use strict";

var locationsOffset;
var queryLimit;
var offset;
var count;

@@ -54,7 +54,19 @@ var probingStartYear;

"maxdate": "1978-12-31"
},
{
"id": "CITY:NL000011",
"maxdate": "2015-01-31"
},
{
"id": "CITY:RS000021",
"maxdate": "2015-03-04"
},
{
"id": "CITY:CD000031",
"maxdate": "1978-12-31"
}
];
locationsOffset = 0;
queryLimit = 500;
offset = 0;
count = 500;
probingStartYear = 2014;

@@ -101,3 +113,3 @@ probingStopYear = 2000;

timer, dataset, datatype, locations,
locationsOffset, queryLimit);
offset, count);
};

@@ -183,3 +195,2 @@

for (i = 0; i < locations.length; i++){
//simulateQueryCompleted(queryResult)
var progress = calcProgress(i + 1);

@@ -193,3 +204,3 @@ console.log.calledWith('progress: ' + progress + '%').should.equal(true)

sinon.spy(dataQuery, 'run');
queryLimit = 2;
count = 2;

@@ -205,3 +216,3 @@ var crawler = getInstance();

// assert
assert.equal(dataQuery.run.callCount, queryLimit);
assert.equal(dataQuery.run.callCount, count);
});

@@ -211,3 +222,3 @@

// arrange
locationsOffset = 1;
offset = 1;
var crawler = getInstance();

@@ -221,3 +232,3 @@

var call = dataQueryFactory.createInstance.getCall(0);
call.args[0].should.be.equal(locations[locationsOffset].id);
call.args[0].should.be.equal(locations[offset].id);
});

@@ -227,3 +238,2 @@

// arrange
var crawler = getInstance();

@@ -243,4 +253,2 @@

// arrange
sinon.spy(dataQuery, 'run');
locations = [

@@ -295,2 +303,52 @@ {

it('should query \'count\' number of locations when offset > 0 (regression)', function(){
// arrange
sinon.spy(dataQuery, 'run');
offset = 3;
count = 3;
var crawler = getInstance();
// act
crawler.run();
for (var i = 0; i < count; i++){
simulateQueryCompleted();
}
// assert
assert.equal(dataQuery.run.callCount, count);
assert.equal(dataQueryFactory.createInstance.callCount, count);
for (var j = 0; j < count; j++){
var call = dataQueryFactory.createInstance.getCall(j);
assert.equal(call.args[0], locations[offset + j].id);
}
});
it('should write progress to console when offset > 0 (regression)', function(){
// arrange
offset = 2;
count = 3;
var crawler = getInstance();
var calcProgress = function(index){
return Math.round((index / count) * 100 * 100) / 100
};
// act
crawler.run();
for (var i = 0; i < count; i++){
simulateQueryCompleted(null)
}
// assert
for (i = 0; i < count; i++){
var progress = calcProgress(i + 1);
console.log.calledWith('progress: ' + progress + '%').should.equal(true)
}
});
});

@@ -297,0 +355,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc