Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
blydro klonk committed Dec 4, 2016
2 parents ecf6b2f + 2fa47e7 commit aa94d72
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ The method parseGeneral obtains the following general metadata:
<meta name ="robots" content="">
<link rel="shortlink" href="">
<title></title>
<html lang="en">
```

## Tests
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ exports.parseGeneral = BBPromise.method(function(chtml){
robots: chtml('meta[name=robots i]').first().attr('content'), //robots <meta name ="robots" content="">
shortlink: chtml('link[rel=shortlink i]').first().attr('href'), //short link <link rel="shortlink" href="">
title: chtml('title').first().text(), //title tag <title>
lang: chtml('html').first().attr('lang') //lang <html lang="">
};

// Copy key-value pairs with defined values to meta
Expand Down
34 changes: 34 additions & 0 deletions test/lang.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

/**
* Tests using externally scraped websites. May fail if resource at
* location changes.
*/

var meta = require('../index');
var assert = require('./utils/assert.js');

// mocha defines to avoid JSHint breakage
/* global describe, it, before, beforeEach, after, afterEach */

describe('LangScraping', function() {

this.timeout(40000);

var url;

describe('Lang parameter from external website', function() {
it('should get hu parameter', function() {
var expected = "hu";
var options = {
url: "http://mno.hu/migr_1834/tellerlevel-cafolat-es-cafolat-700280",
headers: {
'User-Agent': 'webscraper'
}
};
return meta(options, function(error, metadata){
assert.deepEqual(metadata.general.lang, expected);
});
});
});
});
6 changes: 3 additions & 3 deletions test/static.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aa94d72

Please sign in to comment.