From 7331f9560fa5f5dfd94ec86847da07e44e651b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Fri, 19 May 2023 15:23:27 -0400 Subject: [PATCH] fix: generic tag queries not accepting uppercase letters (#312) --- src/utils/filter.ts | 2 +- test/unit/utils/filter.ts | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test/unit/utils/filter.ts 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 + }) +})