Skip to content

Commit 7c79ad2

Browse files
committed
Improve test
1 parent 6d3f900 commit 7c79ad2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/MiniSearch.test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,10 +814,18 @@ describe('MiniSearch', () => {
814814

815815
it('throws an error if removing a field that did not exist', () => {
816816
const ms = new MiniSearch({ fields: ['text', 'author'] })
817-
ms.add({ id: 1, author: 'Al et. al.' })
817+
ms.addAll([
818+
{ id: 1, author: 'Al et. al.' },
819+
{ id: 2, text: 'Some stuff' }
820+
])
821+
818822
expect(() => {
819823
ms.removeFields(1, { text: 'Some interesting stuff' })
820824
}).toThrow('MiniSearch: field text does not exist on document with ID 1')
825+
826+
expect(() => {
827+
ms.removeFields(2, { author: 'Someone' })
828+
}).toThrow('MiniSearch: field author does not exist on document with ID 2')
821829
})
822830
})
823831

0 commit comments

Comments
 (0)