-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
testingTesting related changesTesting related changes
Description
Summary
The components/settings/utils.ts file contains utility functions that lack test coverage. These functions are used by the SettingsContent component and are critical for settings screen reliability.
Current State
File: components/settings/utils.ts
Test Status: ❌ No tests exist
Functions Requiring Tests
-
getStringOrNull(value: unknown): string | null- Converts unknown values to string or null
- Edge cases: undefined, null, empty string, objects, arrays
-
getBuildInfo(): BuildInfo- Returns app version, build number, and runtime version
- Platform-specific behavior (native vs web)
- Error handling for missing values
-
formatBuildInfoForCopy(buildInfo: BuildInfo): string- Formats build info for clipboard copying
- Template string formatting
Recommended Test Cases
// __tests__/components/settings/utils.test.ts
describe('getStringOrNull', () => {
it('returns string for valid string input', () => {});
it('returns null for undefined', () => {});
it('returns null for null', () => {});
it('returns null for empty string', () => {});
it('returns null for objects/arrays', () => {});
it('converts numbers to string', () => {});
});
describe('getBuildInfo', () => {
it('returns version from Constants.expoConfig', () => {});
it('handles missing expo config gracefully', () => {});
it('returns web-specific values on web platform', () => {});
it('returns native-specific values on native platform', () => {});
});
describe('formatBuildInfoForCopy', () => {
it('formats complete build info correctly', () => {});
it('handles null values in build info', () => {});
it('escapes special characters', () => {});
});Acceptance Criteria
- Create
__tests__/components/settings/utils.test.ts - Achieve 100% line coverage for
utils.ts - Test all edge cases and error paths
- Verify tests pass on all platforms (jest default is Node)
Priority
Medium - Settings utilities are foundational but not frequently changed
🤖 Generated by automated codebase review - 2025-12-18
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testingTesting related changesTesting related changes