Skip to content

Commit

Permalink
test: typecheck and code style update
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhengqbbb committed Sep 5, 2024
1 parent dd3a8b3 commit 741635e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/public/_redirects
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* /zh/:splat 302 Language=zh,zh-CN
/ /zh/ 301! Language=zh,zh-CN

/guide /guide/ 301
/config /config/ 301
Expand Down
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export default antfu(
vue: {
'vue/no-v-text-v-html-on-component': 'off',
},
test: {
'test/prefer-lowercase-title': 'off',
},
},
ignores: [
'!./docs/.vitepress',
Expand Down
8 changes: 7 additions & 1 deletion packages/@cz-git/plugin-inquirer/__tests__/fuzzy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { fuzzyFilter, fuzzyMatch } from '../src'
*/
describe('fuzzyMatch', () => {
it('function should be check param fit', () => {
// @ts-expect-error
// @ts-expect-error
expect(fuzzyMatch(null, null)).toBe(null)
// @ts-expect-error
expect(fuzzyMatch(undefined, null)).toBe(null)
Expand Down Expand Up @@ -74,25 +74,31 @@ describe('fuzzyFilter', () => {
})

it('empty input should be return origin array', () => {
// @ts-expect-error
expect(fuzzyFilter('', testArr)).toBe(testArr)
})

it('normal match should be return right array', () => {
// @ts-expect-error
expect(fuzzyFilter('cz-git', testArr)).toEqual([
{ name: 'cz-git', value: 'cz-git', index: 0, score: Infinity },
])
// @ts-expect-error
expect(fuzzyFilter('ty', testArr)).toEqual([
{ name: 'empty', value: false, index: 5, score: 4 },
])
// @ts-expect-error
expect(fuzzyFilter('inq', testArr)).toEqual([
{ name: 'plugin-inquirer', value: 'plugin-inquirer', index: 1, score: 5 },
])
// @ts-expect-error
expect(fuzzyFilter('ii', testArr)).toEqual([
{ name: 'plugin-inquirer', value: 'plugin-inquirer', index: 1, score: 2 },
])
})

it('same score shoule be return sort by index', () => {
// @ts-expect-error
expect(fuzzyFilter('plu', testArr)).toEqual([
{ name: 'plugin-inquirer', value: 'plugin-inquirer', index: 1, score: 11 },
{ name: 'plugin-loader', value: 'plugin-loader', index: 2, score: 11 },
Expand Down
5 changes: 2 additions & 3 deletions packages/@cz-git/plugin-inquirer/__tests__/style.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ describe('isColorizenSupport()', () => {
it('param force false should be false', () => {
expect(isColorizenSupport(false)).toBe(false)
})
it('nO_COLOR should be false', () => {
it('NO_COLOR should be false', () => {
process.env.NO_COLOR = 'true'
expect(isColorizenSupport()).toBe(false)
})
it('tERM is dumb should be false | platform is win32 should be true', () => {
it('TERM is dumb should be false | platform is win32 should be true', () => {
delete process.env.CI
process.env.TERM = 'dumb'
if (process.platform === 'win32')
expect(isColorizenSupport()).toBe(true)

else
expect(isColorizenSupport()).toBe(false)
})
Expand Down

0 comments on commit 741635e

Please sign in to comment.