feat: implement search-first Bible navigator with touch optimization
Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
36
__tests__/lib/bible-search.test.ts
Normal file
36
__tests__/lib/bible-search.test.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { searchBooks, parseReference } from '@/lib/bible-search'
|
||||
|
||||
describe('searchBooks', () => {
|
||||
it('returns results for exact book prefix', () => {
|
||||
const results = searchBooks('Genesis')
|
||||
expect(results.length).toBeGreaterThan(0)
|
||||
expect(results[0].bookName).toBe('Genesis')
|
||||
})
|
||||
|
||||
it('parses "Book Chapter" format', () => {
|
||||
const results = searchBooks('Genesis 5')
|
||||
expect(results[0].chapter).toBe(5)
|
||||
})
|
||||
|
||||
it('works with abbreviations', () => {
|
||||
const results = searchBooks('Gen 1')
|
||||
expect(results[0].bookName).toBe('Genesis')
|
||||
})
|
||||
|
||||
it('returns empty array for empty query', () => {
|
||||
expect(searchBooks('').length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('parseReference', () => {
|
||||
it('parses full book name with chapter', () => {
|
||||
const result = parseReference('Genesis 3')
|
||||
expect(result?.bookId).toBe(1)
|
||||
expect(result?.chapter).toBe(3)
|
||||
})
|
||||
|
||||
it('defaults to chapter 1', () => {
|
||||
const result = parseReference('Genesis')
|
||||
expect(result?.chapter).toBe(1)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user