fix: generic tag queries not accepting uppercase letters (#312)

This commit is contained in:
Ricardo Arturo Cabral Mejía 2023-05-19 15:23:27 -04:00 committed by GitHub
parent 430958f116
commit 7331f9560f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -1 +1 @@
export const isGenericTagQuery = (key: string) => /^#[a-z]$/.test(key)
export const isGenericTagQuery = (key: string) => /^#[a-zA-Z]$/.test(key)

21
test/unit/utils/filter.ts Normal file
View File

@ -0,0 +1,21 @@
import { expect } from 'chai'
import { isGenericTagQuery } from '../../../src/utils/filter'
describe('isGenericTagQuery', () => {
it('returns true for #a', () => {
expect(isGenericTagQuery('#a')).to.be.true
})
it('returns true for #A', () => {
expect(isGenericTagQuery('#A')).to.be.true
})
it('returns false for #0', () => {
expect(isGenericTagQuery('#0')).to.be.false
})
it('returns false for #abc', () => {
expect(isGenericTagQuery('#abc')).to.be.false
})
})