every scraper has _two_ tests for validity (at version 2.0):
var test = require('tape');
var people = require('../lib/people');
test('Scrape undefined profile (error test) ', function(t) {
people(null, function(err){
t.ok(err, 400, 'Receive 400 Error when orgname is undefined');
t.end();
})
})
test('Scrape random (non-existent) profile (error test) ', function(t){
var org = '' + Math.floor(Math.random() * 1000000000000000); // a nice long "random" number
people(org, function(err, data){
t.ok(err === 404, 'Got 404 Error when username does not exist');
t.ok(typeof data === 'undefined', '@param profile is undefined (as expected)');
t.end();
})
})
This is _bonkers_! (the result of copy-pasting boilerplate code!)
and means we have 45 duplicate tests!
Which, as it happens codeclimate has identified:
At present we have 158 tests:
every scraper has _two_ tests for validity (at version 2.0):
This is _bonkers_! (the result of copy-pasting boilerplate code!) and means we have 45 duplicate tests! Which, as it happens codeclimate has identified:
And told us to focus on: