Skip to content

Commit

Permalink
Merge pull request #2 from The-Island/update
Browse files Browse the repository at this point in the history
update deps, fixes
  • Loading branch information
sanderpick authored Mar 4, 2017
2 parents bd2b60b + 40a1429 commit 22239e8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 27 deletions.
14 changes: 7 additions & 7 deletions lib/8a.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Functionality for indexing content for search.

var _ = require('underscore');
_.mixin(require('underscore.string'));
var _s = require('underscore.string');
var util = require('util');
var Step = require('step');
var cheerio = require('cheerio');
Expand All @@ -20,7 +20,7 @@ function format(str) {
str = str.replace(/\\/g, '').trim();
if (str.length > 3) str = str.toLowerCase();
return _.map(str.split(' '), function (w) {
return _.capitalize(w);
return _s.capitalize(w);
}).join(' ');
}

Expand Down Expand Up @@ -202,12 +202,12 @@ exports.getTicks = function(userId, cb) {
sent: true,
style: styleMap[$(els.get(1)).find('img').attr('src')
.split('/')[1].split('.')[0]],
ascent: _.trim(format($(els.get(2)).find('a').text())),
ascent: _s.trim(format($(els.get(2)).find('a').text())),
recommended: userRecommend($(els.get(3)).find('img').attr('src')),
crag: _.trim(format($(els.get(4)).text()).split('/')[0]),
cragCountry: cragCountry ? _.trim(format(cragCountry[1])) : null,
cragCity: cragCity ? _.trim(format(cragCity[1].split(',')[0])) : null,
ascentSector: _.trim(format(
crag: _s.trim(format($(els.get(4)).text()).split('/')[0]),
cragCountry: cragCountry ? _s.trim(format(cragCountry[1])) : null,
cragCity: cragCity ? _s.trim(format(cragCity[1].split(',')[0])) : null,
ascentSector: _s.trim(format(
$(els.get(4)).find('span').text())
.split('/')[1]),
first: $(els.get(5)).text().indexOf('FA') !== -1,
Expand Down
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
"private": true,
"author": "The Island (git://github.com/The-Island)",
"name": "island-lib8a",
"version": "0.0.1",
"version": "0.0.2",
"repository": {
"type": "git",
"url": "git://github.com/Islandio/island-lib8a.git"
},
"main": "lib/8a",
"dependencies": {
"cheerio": "^0.18.0",
"moment": "^2.8.4",
"request": "~2.27.0",
"step": "0.0.5",
"underscore": "^1.4.4",
"underscore.string": "~2.3.1"
"cheerio": "^0.22.0",
"moment": "^2.17.1",
"request": "~2.79.0",
"step": "1.0.0",
"underscore": "~1.8.3",
"underscore.string": "~3.3.4"
},
"engines": {
"node": "~0.10.26"
"scripts": {
"test": "mocha"
},
"devDependencies": {
"mocha": "^3.2.0"
}
}
28 changes: 28 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var lib8a = require('../lib/8a');
var assert = require('assert');

describe('island-lib8a', function() {
this.timeout(10000);
var userId;
describe('#searchUser()', function() {
it('should find the user', function(done) {
lib8a.searchUser('Hodzic', function(err, res) {
if (err) done(err);
assert.ok(res.length > 0)
assert.equal(res[0].name, 'Jasna Hodzic')
userId = res[0].userId
done()
});
});
});

describe('#getTicks()', function() {
it('should get the user\'s ticks', function(done) {
lib8a.getTicks(userId, function(err, res) {
if (err) done(err);
assert.ok(res.length > 0)
done()
});
});
});
});
11 changes: 0 additions & 11 deletions tests/test.js

This file was deleted.

0 comments on commit 22239e8

Please sign in to comment.