Skip to content

Commit

Permalink
Add test for right-hand whitespace
Browse files Browse the repository at this point in the history
Addresses GH #417
  • Loading branch information
hoelzro committed Oct 6, 2019
1 parent c59fd90 commit a67632e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/tokenizer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ suite('lunr.tokenizer', function () {
assert.deepEqual(tokens[1].metadata.position, [5, 3])
})

test('tracking the token position with additional right-hand whitespace', function () {
var tokens = lunr.tokenizer('foo bar ')
assert.deepEqual(tokens[0].metadata.position, [0, 3])
assert.deepEqual(tokens[1].metadata.position, [4, 3])
})

test('providing additional metadata', function () {
var tokens = lunr.tokenizer('foo bar', { 'hurp': 'durp' })
assert.deepEqual(tokens[0].metadata.hurp, 'durp')
Expand Down

0 comments on commit a67632e

Please sign in to comment.