Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

NEW: Use the engine given in argument.

  • Loading branch information...
commit 8ad0a8939ea8fa97813a973276014e2335fef881 1 parent 5bb94e4
@lbdremy authored
Showing with 50 additions and 10 deletions.
  1. +50 −10 test/use-defaults-test.js
View
60 test/use-defaults-test.js
@@ -40,7 +40,11 @@ function runTestSuite(engine){
describe('#get("title")',function(){
it('should retrieve the text representating the title',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-open-graph.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-open-graph.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.equal(scraper.get('title'),'The Rock');
done();
@@ -50,7 +54,11 @@ function runTestSuite(engine){
describe('#get("descriptions")',function(){
it('should retrieve a list of text representating the descriptions',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-open-graph.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-open-graph.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.deepEqual(scraper.get('descriptions'),['Sean Connery found fame and fortune as the suave, sophisticated British agent, James Bond']);
done();
@@ -60,7 +68,11 @@ function runTestSuite(engine){
describe('#get("images")',function(){
it('should retrieve a list of images url',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-open-graph.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-open-graph.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.deepEqual(scraper.get('images'),['http://ia.media-imdb.com/images/rock.jpg']);
done();
@@ -70,7 +82,11 @@ function runTestSuite(engine){
describe('#get("videos")',function(){
it('should retrieve a list of videos [urls or html representations of the videos]',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-open-graph.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-open-graph.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.deepEqual(scraper.get('videos'),['http://example.com/awesome.flv']);
done();
@@ -82,7 +98,11 @@ function runTestSuite(engine){
describe('#get("title")',function(){
it('should retrieve the text representating the title',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-schema-org.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-schema-org.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.equal(scraper.get('title'),'Call of Duty: Modern Warfare III');
done();
@@ -92,7 +112,11 @@ function runTestSuite(engine){
describe('#get("descriptions")',function(){
it('should retrieve a list of text representating the descriptions',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-schema-org.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-schema-org.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.deepEqual(scraper.get('descriptions'),['First Person Shooter game available on consoles and PCs.']);
done();
@@ -102,7 +126,11 @@ function runTestSuite(engine){
describe('#get("images")',function(){
it('should retrieve a list of images url',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-schema-org.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-schema-org.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.deepEqual(scraper.get('images'),['http://www.journaldugamer.com/files/2011/11/mw3-header.jpg']);
done();
@@ -124,7 +152,11 @@ function runTestSuite(engine){
describe('#get("descriptions")',function(){
it('should retrieve a list of text representating the descriptions',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-generic-tags.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-generic-tags.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.deepEqual(scraper.get('descriptions'),['description of the generics tag page']);
done();
@@ -134,7 +166,11 @@ function runTestSuite(engine){
describe('#get("images")',function(){
it('should retrieve a list of images url',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-generic-tags.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-generic-tags.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.deepEqual(scraper.get('images'),['http://localhost/img1.png','http://localhost/img2.png']);
done();
@@ -144,7 +180,11 @@ function runTestSuite(engine){
describe('#get("videos")',function(){
it('should retrieve a list of videos [urls or html representations of the videos]',function(done){
scrapinode.useAll(scrapinode.defaults());
- scrapinode.createScraper('http://localhost:1102/page-generic-tags.html',function(err,scraper){
+ var options = {
+ url : 'http://localhost:1102/page-generic-tags.html',
+ engine : engine
+ };
+ scrapinode.createScraper(options,function(err,scraper){
assert.isNull(err);
assert.deepEqual(scraper.get('videos'),['http://localhost:1102/videofile.ogg','http://localhost:1102/movie.mov']);
done();
Please sign in to comment.
Something went wrong with that request. Please try again.