diff --git a/src/utils/filter.ts b/src/utils/filter.ts index 916e5013..2e1d5c94 100644 --- a/src/utils/filter.ts +++ b/src/utils/filter.ts @@ -1 +1 @@ -export const isGenericTagQuery = (key: string) => /^#[a-z]$/.test(key) +export const isGenericTagQuery = (key: string) => /^#[a-zA-Z]$/.test(key) diff --git a/test/unit/utils/filter.ts b/test/unit/utils/filter.ts new file mode 100644 index 00000000..775dd426 --- /dev/null +++ b/test/unit/utils/filter.ts @@ -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 + }) +})