fix: add missing lan test and simplify apk-parser implementation
- Add missing test case for lan environment detection - Simplify detectEnvironment() to match spec exactly - Remove extra logic (version number detection, ft_ prefix check) - Update test expectations to match simplified implementation behavior - All tests now pass with spec-compliant implementation
This commit is contained in:
@@ -20,22 +20,11 @@ export function detectEnvironment(filename: string): ApkEnvironment {
|
||||
const match = filename.match(/^ft_([^_]+)_/);
|
||||
|
||||
if (!match) {
|
||||
// If it doesn't start with ft_ at all, it's an invalid format
|
||||
if (!filename.startsWith('ft_')) {
|
||||
return 'other';
|
||||
}
|
||||
// Starts with ft_ but has no additional segments (malformed), return 'other'
|
||||
return 'other';
|
||||
}
|
||||
|
||||
const env = match[1].toLowerCase();
|
||||
|
||||
// If the extracted segment starts with a digit, it's a version number, not an environment
|
||||
// This means it's a product APK with no environment suffix
|
||||
if (/^\d/.test(env)) {
|
||||
// No environment suffix, default to product
|
||||
return 'product';
|
||||
}
|
||||
|
||||
const env = match[1].toLowerCase();
|
||||
return ENVIRONMENT_MAP[env] || 'other';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user