Files
wehub-resource-sync 719032b19f
Update Schema / Update configuration json schema (push) Has been cancelled
Memory Benchmark / Memory Test (Full Analysis) (push) Has been cancelled
CI Quality / Lint GitHub Actions (actionlint) (push) Has been cancelled
CI Quality / Lint GitHub Actions (zizmor) (push) Has been cancelled
CI Quality / Check typos (push) Has been cancelled
CI / Test coverage (push) Has been cancelled
CI / Test (22.x, windows-latest) (push) Has been cancelled
CI / Test (24.x, macos-latest) (push) Has been cancelled
CI / Test (24.x, ubuntu-latest) (push) Has been cancelled
CI / Test (24.x, windows-latest) (push) Has been cancelled
CI / Test (26.x, macos-latest) (push) Has been cancelled
CI / Test (26.x, ubuntu-latest) (push) Has been cancelled
CI / Test (26.x, windows-latest) (push) Has been cancelled
CI / Test with Bun (latest, macos-latest) (push) Has been cancelled
CI / Test with Bun (latest, ubuntu-latest) (push) Has been cancelled
CI / Test with Bun (latest, windows-latest) (push) Has been cancelled
CI / Build and run (22.x, macos-latest) (push) Has been cancelled
CI / Build and run (22.x, ubuntu-latest) (push) Has been cancelled
CI / Build and run (22.x, windows-latest) (push) Has been cancelled
autofix.ci / autofix (push) Has been cancelled
CI Browser Extension / Lint Browser Extension (push) Has been cancelled
CI Browser Extension / Test Browser Extension (push) Has been cancelled
Memory Benchmark / Memory Test (push) Has been cancelled
CI Website / Lint Website Client (push) Has been cancelled
CI Website / Lint Website Server (push) Has been cancelled
CI Website / Test Website Server (push) Has been cancelled
CI Website / Bundle Website Server (push) Has been cancelled
CI / Lint Biome (push) Has been cancelled
CI / Lint oxlint (push) Has been cancelled
CI / Lint TypeScript (push) Has been cancelled
CI / Lint Secretlint (push) Has been cancelled
CI / Test (22.x, macos-latest) (push) Has been cancelled
CI / Test (22.x, ubuntu-latest) (push) Has been cancelled
CI / Build and run (24.x, macos-latest) (push) Has been cancelled
CI / Build and run (24.x, ubuntu-latest) (push) Has been cancelled
CI / Build and run (24.x, windows-latest) (push) Has been cancelled
CI / Build and run (26.x, macos-latest) (push) Has been cancelled
CI / Build and run (26.x, ubuntu-latest) (push) Has been cancelled
CI / Build and run (26.x, windows-latest) (push) Has been cancelled
CI / Build and run with Bun (latest, macos-latest) (push) Has been cancelled
CI / Build and run with Bun (latest, ubuntu-latest) (push) Has been cancelled
CI / Build and run with Bun (latest, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Docker / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker / build (linux/arm/v7, ubuntu-24.04-arm) (push) Has been cancelled
Docker / build (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker / merge (push) Has been cancelled
Pack repository with Repomix / pack-repo (push) Has been cancelled
Performance Benchmark History / Benchmark (macos-latest) (push) Has been cancelled
Performance Benchmark History / Benchmark (ubuntu-latest) (push) Has been cancelled
Performance Benchmark History / Benchmark (windows-latest) (push) Has been cancelled
Performance Benchmark History / Store Results (push) Has been cancelled
Test Repomix Action / Test Node.js 22 (push) Has been cancelled
Test Repomix Action / Test Node.js 24 (push) Has been cancelled
Test Repomix Action / Test Node.js 26 (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:39:37 +08:00

55 lines
2.0 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { splitPatterns } from '../../src/shared/patternUtils.js';
describe('patternUtils', () => {
describe('splitPatterns', () => {
it('should correctly split patterns without braces', () => {
const patterns = 'src/**,tests/**,*.js';
const result = splitPatterns(patterns);
expect(result).toEqual(['src/**', 'tests/**', '*.js']);
});
it('should preserve brace expansion patterns', () => {
const patterns = 'src/**,**/{__tests__,theme}/**,*.{js,ts}';
const result = splitPatterns(patterns);
expect(result).toEqual(['src/**', '**/{__tests__,theme}/**', '*.{js,ts}']);
});
it('should handle nested braces', () => {
const patterns = 'src/{components/{Button,Input},utils}/**';
const result = splitPatterns(patterns);
expect(result).toEqual(['src/{components/{Button,Input},utils}/**']);
});
it('should handle empty patterns', () => {
expect(splitPatterns('')).toEqual([]);
expect(splitPatterns(undefined)).toEqual([]);
});
it('should handle patterns with escaped braces', () => {
const patterns = 'src/\\{file\\}.js,tests/**';
const result = splitPatterns(patterns);
// Note: Escaped braces are treated as regular characters, not brace delimiters
expect(result).toEqual(['src/\\{file\\}.js', 'tests/**']);
});
it('should handle trailing commas', () => {
const patterns = 'src/**,tests/**,';
const result = splitPatterns(patterns);
expect(result).toEqual(['src/**', 'tests/**']);
});
it('should handle leading commas', () => {
const patterns = ',src/**,tests/**';
const result = splitPatterns(patterns);
expect(result).toEqual(['src/**', 'tests/**']);
});
it('should trim whitespace around patterns', () => {
const patterns = ' src/** , tests/** , **/*.js ';
const result = splitPatterns(patterns);
expect(result).toEqual(['src/**', 'tests/**', '**/*.js']);
});
});
});