simplecrawler
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -309,3 +309,5 @@ // Simplecrawler | ||
// They should be the same flipped around! | ||
return subdomain.reverse().substr(0,host.length) === host.reverse(); | ||
return ( | ||
subdomain.split("").reverse().join("").substr(0,host.length) === | ||
host.split("").reverse().join("")); | ||
} | ||
@@ -312,0 +314,0 @@ |
{ | ||
"name": "simplecrawler", | ||
"description": "Very straigntforward web crawler. Uses EventEmitter. Generates queue statistics and has a basic cache mechanism with extensible backend.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "http://github.com/cgiffard/node-simplecrawler", | ||
@@ -6,0 +6,0 @@ "author": "Christopher Giffard <christopher.giffard@cgiffard.com>", |
@@ -9,5 +9,30 @@ // Tests whether a given resource is considered 'valid' for crawling under | ||
it("should be able to determine whether a domain is a subdomain of another", | ||
function() { | ||
var crawler = new (require("../"))("example.com",3000); | ||
// Enable scanning subdomains, important for this test | ||
crawler.scanSubdomains = true; | ||
// The domain itself isn't a subdomain per-se, but should be allowed | ||
crawler.domainValid("example.com").should.equal(true); | ||
// WWW is a subdomain | ||
crawler.domainValid("www.example.com").should.equal(true); | ||
// More complex examples | ||
crawler.domainValid("testing.example.com").should.equal(true); | ||
// Multiple levels | ||
crawler.domainValid("system.cache.example.com").should.equal(true); | ||
// These aren't valid... | ||
crawler.domainValid("com.example").should.equal(false); | ||
crawler.domainValid("example.com.au").should.equal(false); | ||
crawler.domainValid("example.us").should.equal(false); | ||
}); | ||
}); | ||
@@ -14,0 +39,0 @@ |
64934
1255