Test that matching can handle pluses

This commit is contained in:
Sam Carlton 2022-04-24 10:57:30 -05:00
parent e927c8bbb8
commit ebfea478fb

View file

@ -4,6 +4,11 @@ import test from 'ava'
import { isValidHttpUrl } from '../helpers/check-types.js'
import { buildReadmeAppList } from '../helpers/build-app-list.js'
import {
matchesWholeWord,
fuzzyMatchesWholeWord,
eitherMatches
} from '../helpers/matching.js'
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()
})