Comparing version 0.3.7 to 0.3.8
{ | ||
"name": "birdwatch", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "Monitor and cache specific twitter feeds", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -107,3 +107,3 @@ 'use strict'; | ||
console.log("tweetdata ", tweetdata); | ||
assert(tweetdata[0].text.search("#09") > -1); | ||
assert(tweetdata.length === 1); | ||
}); | ||
@@ -110,0 +110,0 @@ |
23
utils.js
@@ -131,2 +131,3 @@ 'use strict'; | ||
if( bwoptions.useTestData ){ | ||
console.log("bwoptions.useTestData == true, resolving `true` from setupCredentials()"); | ||
resolve(true); | ||
@@ -137,4 +138,7 @@ return; | ||
fsAccess( __dirname + '/configure/local_configure.js', function(err){ | ||
var configureFile = __dirname + "/configure/local_configure.js"; | ||
fsAccess(configureFile, function(err){ | ||
if(err) { | ||
console.log("Error accessing "+configureFile+", resolving `true` from setupCredentials()"); | ||
resolve(true); | ||
@@ -151,3 +155,3 @@ } else { | ||
}); | ||
console.log("Found local_configure.js, resolving `false` from setupCredentials()"); | ||
resolve(false); | ||
@@ -182,3 +186,3 @@ } | ||
// Send test_tweets in testing environments | ||
if(testmode){ | ||
if(testmode === true){ | ||
@@ -368,6 +372,3 @@ resolve(test_tweets); | ||
// TODO: make the process wait until in_memory cache is available. | ||
// This will allow the process to be properly tested. | ||
// Otherwise the on-disk cache file is always served in the test scenarios, | ||
// and we can't test sorting, and removing retweets, etc if this is the case | ||
// TODO: Figure out a better way to serve the cached data. | ||
// See https://github.com/radiovisual/birdwatch/issues/4 | ||
@@ -378,9 +379,11 @@ // | ||
// to the disk. This at least gives the test_tweet data to make it into the in-memory | ||
// cache. Which might let my test data be used in Mocha. | ||
// cache -- Which might let my test data be used in Mocha. However, I realize that this | ||
// makes first call to Birdwatch respond slowly. I know there is a better way, I just | ||
// haven't thought of it yet. | ||
// | ||
// IF YOU HAVE A BETTER IDEA, I WOULD LOVE SOME INPUT! | ||
// | ||
// Maybe this will help: http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt2-practical-use | ||
if (in_memory_cache.length > 0){ | ||
console.log("serving from in_memory_cache (before setTimer)"); | ||
resolve(in_memory_cache); | ||
@@ -394,2 +397,3 @@ | ||
console.log("serving from in_memory_cache (after setTimer)"); | ||
resolve(in_memory_cache); | ||
@@ -404,2 +408,3 @@ | ||
} else { | ||
console.log("serving from on-disk cache"); | ||
resolve(JSON.parse(data)); | ||
@@ -406,0 +411,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34814
546