fix: correct apk-parser test expectations and regex pattern
- Use letter-only regex pattern /ft_([a-z]+)_/i to correctly detect environment suffixes - This ensures version numbers (starting with digits) are treated as no environment suffix - Update test expectations to match spec behavior: - ft_0_42_ff9ff3441.apk now correctly returns 'product' (no match) - invalid_filename.apk returns 'product' (no match) - All 10 tests pass with corrected implementation
This commit is contained in:
@@ -16,8 +16,8 @@ const ENVIRONMENT_MAP: Record<string, ApkEnvironment> = {
|
||||
|
||||
export function detectEnvironment(filename: string): ApkEnvironment {
|
||||
// Pattern: ft_[environment]_version_commit.apk
|
||||
// Extract the environment segment between first and second underscores
|
||||
const match = filename.match(/^ft_([^_]+)_/);
|
||||
// Extract the environment segment (alphabetic only) between first and second underscores
|
||||
const match = filename.match(/^ft_([a-z]+)_/i);
|
||||
|
||||
if (!match) {
|
||||
// No environment suffix, default to product
|
||||
|
||||
Reference in New Issue
Block a user