mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-06-14 23:01:01 +00:00
Add comprehensive test infrastructure and Dark Mode tests
- Created test folder structure (__tests__, __mocks__) - Added mock contexts (Theme, BiometricAuth, Auth) - Added mock AsyncStorage - Implemented 11 passing Dark Mode tests: * Rendering tests (3 tests) * Toggle functionality tests (2 tests) * Persistence tests (2 tests) * Theme application tests (2 tests) * Edge case tests (2 tests) - Added testID props to SettingsScreen components - All tests passing (11/11) Test Coverage: - Dark Mode toggle on/off - AsyncStorage persistence - Theme color application - Rapid toggle handling - Multiple toggle calls
This commit is contained in:
@@ -111,12 +111,14 @@ const SettingsScreen: React.FC = () => {
|
||||
subtitle,
|
||||
value,
|
||||
onToggle,
|
||||
testID,
|
||||
}: {
|
||||
icon: string;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
value: boolean;
|
||||
onToggle: (value: boolean) => void;
|
||||
testID?: string;
|
||||
}) => (
|
||||
<View style={styles.settingItem}>
|
||||
<View style={styles.settingIcon}>
|
||||
@@ -127,6 +129,7 @@ const SettingsScreen: React.FC = () => {
|
||||
{subtitle && <Text style={styles.settingSubtitle}>{subtitle}</Text>}
|
||||
</View>
|
||||
<Switch
|
||||
testID={testID}
|
||||
value={value}
|
||||
onValueChange={onToggle}
|
||||
trackColor={{ false: '#E0E0E0', true: KurdistanColors.kesk }}
|
||||
@@ -136,7 +139,7 @@ const SettingsScreen: React.FC = () => {
|
||||
);
|
||||
|
||||
return (
|
||||
<SafeAreaView style={styles.container}>
|
||||
<SafeAreaView style={styles.container} testID="settings-screen">
|
||||
<StatusBar barStyle={isDarkMode ? "light-content" : "dark-content"} />
|
||||
|
||||
{/* Header */}
|
||||
@@ -161,6 +164,7 @@ const SettingsScreen: React.FC = () => {
|
||||
onToggle={async () => {
|
||||
await toggleDarkMode();
|
||||
}}
|
||||
testID="dark-mode-switch"
|
||||
/>
|
||||
|
||||
<SettingItem
|
||||
|
||||
Reference in New Issue
Block a user