var parser = require('../../../lib/plugin/in/webpageparse.js'),
    here = require('here').here,
    nock = require('nock');

describe('input plugin: webpageparse', function(){
  var mockSite1 = "http://test1.hideack";
  var mockSite2 = "http://test2.hideack";

  beforeEach(function() {
    var testBody = here(/*
    <html>
     <head>
      <title>PHP Test</title>
     </head>
     <body>
       <p id="evac">foobar</p>
     </body>
    </html>
    */
    ).unindent();

    nock(mockSite1).get('/').reply(200, testBody);
    nock(mockSite2).get('/').reply(200, testBody);
  });

  it('should be get to HTTP contents.', function(done){
    parser.load({url:"http://test1.hideack/", target:"#evac"}, function(error, outputs){
      error.should.be.false;
      done();
    });
  });

  it('should be get to any HTTP contents.', function(done){
    parser.load({url:["http://test1.hideack/", "http://test2.hideack/"], target:"#evac"}, function(error, outputs){
      error.should.be.false;
      outputs.should.deep.equal(["foobar", "foobar"]);
      done();
    });
  });

});


@@ -297,16 +297,17 @@
 testBody
+1
  = here(
@@ -309,16 +309,16 @@
 here(/*%0A
-
     %3Chtm
@@ -469,16 +469,206 @@
 ent();%0A%0A
+    var testBody2 = here(/*%0A    %3Chtml%3E%0A     %3Chead%3E%0A      %3Ctitle%3EPHP Test%3C/title%3E%0A     %3C/head%3E%0A     %3Cbody%3E%0A       %3Cp id=%22evac%22%3Ehogemoge%3C/p%3E%0A     %3C/body%3E%0A    %3C/html%3E%0A    */%0A    ).unindent();%0A%0A
     nock
@@ -703,24 +703,25 @@
 00, testBody
+1
 );%0A    nock(
@@ -759,16 +759,17 @@
 testBody
+2
 );%0A  %7D);
@@ -1222,22 +1222,24 @@
 obar%22, %22
-foobar
+hogemoge
 %22%5D);%0A   

テスト修正 複数のURL毎に取得されるコンテンツを切り分ける