mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:13:07 +00:00
Nova Soure vs Nova Canaã compartilham o primeiro token; distinctWordStartQuery escolhe palavra que casa só com o alvo e evita falso positivo no assessor.
14 lines
564 B
TypeScript
14 lines
564 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { distinctWordStartQuery } from '../helpers/distinctWordStartQuery'
|
|
|
|
describe('distinctWordStartQuery', () => {
|
|
it('returns a word that matches only the target name', () => {
|
|
expect(distinctWordStartQuery('Nova Canaã', 'Nova Soure')).toBe('Canaã')
|
|
expect(distinctWordStartQuery('Nova Soure', 'Nova Canaã')).toBe('Soure')
|
|
})
|
|
|
|
it('falls back to the first word when names do not share a prefix token', () => {
|
|
expect(distinctWordStartQuery('Cairu', 'Feira de Santana')).toBe('Cairu')
|
|
})
|
|
})
|