mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Test that matching can handle pluses
This commit is contained in:
parent
e927c8bbb8
commit
ebfea478fb
1 changed files with 32 additions and 0 deletions
|
|
@ -4,6 +4,11 @@ import test from 'ava'
|
||||||
|
|
||||||
import { isValidHttpUrl } from '../helpers/check-types.js'
|
import { isValidHttpUrl } from '../helpers/check-types.js'
|
||||||
import { buildReadmeAppList } from '../helpers/build-app-list.js'
|
import { buildReadmeAppList } from '../helpers/build-app-list.js'
|
||||||
|
import {
|
||||||
|
matchesWholeWord,
|
||||||
|
fuzzyMatchesWholeWord,
|
||||||
|
eitherMatches
|
||||||
|
} from '../helpers/matching.js'
|
||||||
|
|
||||||
|
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
|
|
@ -146,3 +151,30 @@ test('README Apps are in alphbetical order', (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const namesWithPlusses = [
|
||||||
|
'Xournal++',
|
||||||
|
'Notepad++'
|
||||||
|
]
|
||||||
|
|
||||||
|
test('Can match names with pluses', (t) => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Sort apps in groups alphabetically
|
||||||
|
for ( const nameWithPluses of namesWithPlusses ) {
|
||||||
|
|
||||||
|
const haystack = `FDKLS:KF ${nameWithPluses}NDFLSKFLSJDK`
|
||||||
|
|
||||||
|
t.assert( matchesWholeWord( nameWithPluses, haystack ) )
|
||||||
|
|
||||||
|
t.assert( fuzzyMatchesWholeWord( nameWithPluses, haystack ) )
|
||||||
|
|
||||||
|
t.assert( eitherMatches( nameWithPluses, haystack ) )
|
||||||
|
t.assert( eitherMatches( haystack, nameWithPluses ) )
|
||||||
|
}
|
||||||
|
|
||||||
|
t.pass()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue