securityos/node_modules/lunr/test/stemmer_test.js

27 lines
705 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
suite('lunr.stemmer', function () {
test('reduces words to their stem', function (done) {
withFixture('stemming_vocab.json', function (err, fixture) {
if (err != null) {
throw err
}
var testData = JSON.parse(fixture)
Object.keys(testData).forEach(function (word) {
var expected = testData[word],
token = new lunr.Token(word),
result = lunr.stemmer(token).toString()
assert.equal(expected, result)
})
done()
})
})
test('is a registered pipeline function', function () {
assert.equal('stemmer', lunr.stemmer.label)
assert.equal(lunr.stemmer, lunr.Pipeline.registeredFunctions['stemmer'])
})
})