fix tests
This commit is contained in:
parent
31422eafcf
commit
39fba2e7f0
|
@ -172,8 +172,6 @@ function is(pos){
|
|||
* Credit for this routine to https://github.com/NaturalNode/natural
|
||||
*/
|
||||
function lineDataToJSON(line, location) {
|
||||
// if (!dataCheck(line, location)) return new Error('Bad data at location ' + location);
|
||||
|
||||
var data = line.split('| '),
|
||||
tokens = data[0].split(/\s+/),
|
||||
ptrs = [],
|
||||
|
|
|
@ -52,11 +52,9 @@ function readLocation(location, callback) {
|
|||
return;
|
||||
}
|
||||
//console.log(' read %d bytes at <%d>', count, location);
|
||||
if (!dataCheck(str, location)) return callback(new Error('Bad data at location ' + location));
|
||||
|
||||
callback(null, function() {
|
||||
if (!dataCheck(str, location)) return new Error('Bad data at location ' + location);
|
||||
lineDataToJSON(str, location)
|
||||
});
|
||||
callback(null, lineDataToJSON(str, location));
|
||||
});
|
||||
|
||||
function readChunk(pos, cb) {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
/*!
|
||||
* wordpos.js
|
||||
*
|
||||
* Node.js part-of-speech utilities using WordNet database.
|
||||
*
|
||||
* Copyright (c) 2012-2019 mooster@42at.com
|
||||
* https://github.com/moos/wordpos
|
||||
*
|
||||
* Released under MIT license
|
||||
*/
|
||||
|
||||
if (process.browser) {
|
||||
module.exports = require('./browser');
|
||||
} else {
|
||||
module.exports = require('./node');
|
||||
}
|
|
@ -372,7 +372,7 @@ describe('seek()...', function() {
|
|||
it('should handle bad offset', function(done) {
|
||||
wordpos.seek('foobar', 'a', function(err, result){
|
||||
assert(err instanceof Error);
|
||||
assert.equal(err.message, 'offset must be valid positive number.');
|
||||
assert.equal(err.message, 'Offset must be valid positive number: foobar');
|
||||
done();
|
||||
}).catch(_.noop); // UnhandledPromiseRejectionWarning
|
||||
});
|
||||
|
@ -498,8 +498,8 @@ describe('Promise pattern', function() {
|
|||
it('seek() - bad offset', function () {
|
||||
return wordpos.seek('foobar', 'a').catch(function (err) {
|
||||
assert(err instanceof Error);
|
||||
assert.equal(err.message, 'offset must be valid positive number.');
|
||||
assert.equal(err.message, 'Offset must be valid positive number: foobar');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue