fix: Remove workspace config, fix test suite, update snapshots

- Remove root /home/mamostehp/package.json workspace config
- Each project now independent (aligned with CI workflow)
- Add SafeAreaProvider mock to jest setup
- Add __DEV__ global for React Native tests
- Update 4 snapshots for SafeAreaView changes
- All 29 test suites pass (122 tests)
This commit is contained in:
2026-01-19 15:26:47 +03:00
parent 0feeefe40c
commit c260da18b1
12 changed files with 17118 additions and 520 deletions
+3
View File
@@ -1,6 +1,9 @@
// Setup file that runs BEFORE setupFilesAfterEnv
// This is needed to mock Expo's winter runtime before it loads
// Define __DEV__ global for React Native
global.__DEV__ = true;
// Mock the __ExpoImportMetaRegistry getter to prevent winter errors
Object.defineProperty(global, '__ExpoImportMetaRegistry__', {
get() {
+12
View File
@@ -68,6 +68,18 @@ jest.mock('./src/contexts/ThemeContext', () => require('./src/__mocks__/contexts
// Mock BiometricAuthContext globally
jest.mock('./src/contexts/BiometricAuthContext', () => require('./src/__mocks__/contexts/BiometricAuthContext'));
// Mock react-native-safe-area-context
jest.mock('react-native-safe-area-context', () => {
const insets = { top: 0, right: 0, bottom: 0, left: 0 };
return {
SafeAreaProvider: ({ children }) => children,
SafeAreaView: ({ children }) => children,
useSafeAreaInsets: () => insets,
useSafeAreaFrame: () => ({ x: 0, y: 0, width: 390, height: 844 }),
initialWindowMetrics: { insets, frame: { x: 0, y: 0, width: 390, height: 844 } },
};
});
// Mock expo modules
jest.mock('expo-linear-gradient', () => ({
LinearGradient: 'LinearGradient',
+16123
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -59,7 +59,6 @@
"react": "19.1.0",
"react-dom": "19.1.0",
"react-i18next": "^16.3.3",
"react-native": "0.81.5",
"react-native-gesture-handler": "~2.28.0",
"react-native-get-random-values": "~1.11.0",
"react-native-qrcode-svg": "^6.3.11",
@@ -110,7 +109,8 @@
"eslint-plugin-react-native": "^5.0.0",
"globals": "^16.5.0",
"jest": "^29.7.0",
"jest-expo": "^54.0.13",
"jest-expo": "^54.0.16",
"react-native": "^0.83.1",
"react-test-renderer": "19.1.0",
"typescript": "~5.9.2",
"typescript-eslint": "^8.47.0"
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`BeCitizenScreen should match snapshot 1`] = `
<RCTSafeAreaView
<View
style={
{
"backgroundColor": "#FFFFFF",
@@ -12,94 +12,86 @@ exports[`BeCitizenScreen should match snapshot 1`] = `
<View
style={
{
"alignItems": "center",
"backgroundColor": "#FFFFFF",
"flex": 1,
"borderBottomColor": "#E0E0E0",
"borderBottomWidth": 1,
"flexDirection": "row",
"justifyContent": "space-between",
"paddingHorizontal": 16,
"paddingVertical": 12,
}
}
>
<View
<Text
style={
{
"alignItems": "center",
"backgroundColor": "#FFFFFF",
"borderBottomColor": "#E0E0E0",
"borderBottomWidth": 1,
"flexDirection": "row",
"justifyContent": "space-between",
"paddingHorizontal": 16,
"paddingVertical": 12,
"color": "#000",
"flex": 1,
"fontSize": 18,
"fontWeight": "700",
"textAlign": "center",
}
}
>
Be Citizen
</Text>
<View
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
{
"opacity": 1,
"padding": 8,
}
}
>
<Text
style={
{
"color": "#000",
"flex": 1,
"fontSize": 18,
"fontWeight": "700",
"textAlign": "center",
"color": "#00A94F",
"fontSize": 14,
"fontWeight": "600",
}
}
>
Be Citizen
Reload
</Text>
<View
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
{
"opacity": 1,
"padding": 8,
}
}
>
<Text
style={
{
"color": "#00A94F",
"fontSize": 14,
"fontWeight": "600",
}
}
>
Reload
</Text>
</View>
</View>
<WebView
allowsBackForwardNavigationGestures={true}
allowsInlineMediaPlayback={true}
bounces={true}
cacheEnabled={true}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}
injectedJavaScript="
</View>
<WebView
allowsBackForwardNavigationGestures={true}
allowsInlineMediaPlayback={true}
bounces={true}
cacheEnabled={true}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}
injectedJavaScript="
(function() {
// Mark this as mobile app
window.PEZKUWI_MOBILE = true;
@@ -109,6 +101,36 @@ exports[`BeCitizenScreen should match snapshot 1`] = `
window.PEZKUWI_ADDRESS = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
window.PEZKUWI_ACCOUNT_NAME = 'Mobile Wallet';
// Inject auth session for automatic login
window.PEZKUWI_USER_ID = 'test-user-id';
window.PEZKUWI_USER_EMAIL = 'test@pezkuwichain.io';
// Auto-authenticate with Supabase if session token exists
if (window.PEZKUWI_SESSION_TOKEN) {
(function autoAuth(attempts = 0) {
if (attempts > 50) {
console.warn('[Mobile] Auto-auth timed out: window.supabase not found');
return;
}
if (window.supabase && window.supabase.auth) {
window.supabase.auth.setSession({
access_token: window.PEZKUWI_SESSION_TOKEN,
refresh_token: window.PEZKUWI_REFRESH_TOKEN || ''
}).then(function(res) {
if (res.error) console.warn('[Mobile] Auto-auth error:', res.error);
else console.log('[Mobile] Auto-authenticated successfully');
}).catch(function(err) {
console.warn('[Mobile] Auto-auth promise failed:', err);
});
} else {
setTimeout(function() { autoAuth(attempts + 1); }, 100);
}
})(0);
}
// Override console.log to send to React Native (for debugging)
const originalConsoleLog = console.log;
console.log = function(...args) {
@@ -166,66 +188,65 @@ exports[`BeCitizenScreen should match snapshot 1`] = `
true; // Required for injectedJavaScript
})();
"
javaScriptEnabled={true}
mediaPlaybackRequiresUserAction={false}
onError={[Function]}
onHttpError={[Function]}
onLoadEnd={[Function]}
onLoadStart={[Function]}
onMessage={[Function]}
onNavigationStateChange={[Function]}
pullToRefreshEnabled={true}
ref={
{
"current": null,
}
javaScriptEnabled={true}
mediaPlaybackRequiresUserAction={false}
onError={[Function]}
onHttpError={[Function]}
onLoadEnd={[Function]}
onLoadStart={[Function]}
onMessage={[Function]}
onNavigationStateChange={[Function]}
pullToRefreshEnabled={true}
ref={
{
"current": null,
}
sharedCookiesEnabled={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={true}
source={
{
"uri": "https://pezkuwichain.io/be-citizen",
}
}
sharedCookiesEnabled={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={true}
source={
{
"uri": "https://pezkuwichain.io/be-citizen",
}
style={
{
"flex": 1,
}
}
style={
{
"flex": 1,
}
thirdPartyCookiesEnabled={true}
webviewDebuggingEnabled={true}
}
thirdPartyCookiesEnabled={true}
webviewDebuggingEnabled={true}
/>
<View
style={
{
"alignItems": "center",
"backgroundColor": "rgba(255, 255, 255, 0.9)",
"bottom": 0,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
>
<ActivityIndicator
color="#00A94F"
size="large"
/>
<View
<Text
style={
{
"alignItems": "center",
"backgroundColor": "rgba(255, 255, 255, 0.9)",
"bottom": 0,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"color": "#666",
"fontSize": 14,
"marginTop": 12,
}
}
>
<ActivityIndicator
color="#00A94F"
size="large"
/>
<Text
style={
{
"color": "#666",
"fontSize": 14,
"marginTop": 12,
}
}
>
Loading...
</Text>
</View>
Loading...
</Text>
</View>
</RCTSafeAreaView>
</View>
`;
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EducationScreen should match snapshot 1`] = `
<RCTSafeAreaView
<View
style={
{
"backgroundColor": "#FFFFFF",
@@ -12,94 +12,86 @@ exports[`EducationScreen should match snapshot 1`] = `
<View
style={
{
"alignItems": "center",
"backgroundColor": "#FFFFFF",
"flex": 1,
"borderBottomColor": "#E0E0E0",
"borderBottomWidth": 1,
"flexDirection": "row",
"justifyContent": "space-between",
"paddingHorizontal": 16,
"paddingVertical": 12,
}
}
>
<View
<Text
style={
{
"alignItems": "center",
"backgroundColor": "#FFFFFF",
"borderBottomColor": "#E0E0E0",
"borderBottomWidth": 1,
"flexDirection": "row",
"justifyContent": "space-between",
"paddingHorizontal": 16,
"paddingVertical": 12,
"color": "#000",
"flex": 1,
"fontSize": 18,
"fontWeight": "700",
"textAlign": "center",
}
}
>
Perwerde
</Text>
<View
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
{
"opacity": 1,
"padding": 8,
}
}
>
<Text
style={
{
"color": "#000",
"flex": 1,
"fontSize": 18,
"fontWeight": "700",
"textAlign": "center",
"color": "#00A94F",
"fontSize": 14,
"fontWeight": "600",
}
}
>
Perwerde
Reload
</Text>
<View
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
{
"opacity": 1,
"padding": 8,
}
}
>
<Text
style={
{
"color": "#00A94F",
"fontSize": 14,
"fontWeight": "600",
}
}
>
Reload
</Text>
</View>
</View>
<WebView
allowsBackForwardNavigationGestures={true}
allowsInlineMediaPlayback={true}
bounces={true}
cacheEnabled={true}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}
injectedJavaScript="
</View>
<WebView
allowsBackForwardNavigationGestures={true}
allowsInlineMediaPlayback={true}
bounces={true}
cacheEnabled={true}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}
injectedJavaScript="
(function() {
// Mark this as mobile app
window.PEZKUWI_MOBILE = true;
@@ -109,6 +101,36 @@ exports[`EducationScreen should match snapshot 1`] = `
window.PEZKUWI_ADDRESS = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
window.PEZKUWI_ACCOUNT_NAME = 'Mobile Wallet';
// Inject auth session for automatic login
window.PEZKUWI_USER_ID = 'test-user-id';
window.PEZKUWI_USER_EMAIL = 'test@pezkuwichain.io';
// Auto-authenticate with Supabase if session token exists
if (window.PEZKUWI_SESSION_TOKEN) {
(function autoAuth(attempts = 0) {
if (attempts > 50) {
console.warn('[Mobile] Auto-auth timed out: window.supabase not found');
return;
}
if (window.supabase && window.supabase.auth) {
window.supabase.auth.setSession({
access_token: window.PEZKUWI_SESSION_TOKEN,
refresh_token: window.PEZKUWI_REFRESH_TOKEN || ''
}).then(function(res) {
if (res.error) console.warn('[Mobile] Auto-auth error:', res.error);
else console.log('[Mobile] Auto-authenticated successfully');
}).catch(function(err) {
console.warn('[Mobile] Auto-auth promise failed:', err);
});
} else {
setTimeout(function() { autoAuth(attempts + 1); }, 100);
}
})(0);
}
// Override console.log to send to React Native (for debugging)
const originalConsoleLog = console.log;
console.log = function(...args) {
@@ -166,66 +188,65 @@ exports[`EducationScreen should match snapshot 1`] = `
true; // Required for injectedJavaScript
})();
"
javaScriptEnabled={true}
mediaPlaybackRequiresUserAction={false}
onError={[Function]}
onHttpError={[Function]}
onLoadEnd={[Function]}
onLoadStart={[Function]}
onMessage={[Function]}
onNavigationStateChange={[Function]}
pullToRefreshEnabled={true}
ref={
{
"current": null,
}
javaScriptEnabled={true}
mediaPlaybackRequiresUserAction={false}
onError={[Function]}
onHttpError={[Function]}
onLoadEnd={[Function]}
onLoadStart={[Function]}
onMessage={[Function]}
onNavigationStateChange={[Function]}
pullToRefreshEnabled={true}
ref={
{
"current": null,
}
sharedCookiesEnabled={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={true}
source={
{
"uri": "https://pezkuwichain.io/education",
}
}
sharedCookiesEnabled={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={true}
source={
{
"uri": "https://pezkuwichain.io/education",
}
style={
{
"flex": 1,
}
}
style={
{
"flex": 1,
}
thirdPartyCookiesEnabled={true}
webviewDebuggingEnabled={true}
}
thirdPartyCookiesEnabled={true}
webviewDebuggingEnabled={true}
/>
<View
style={
{
"alignItems": "center",
"backgroundColor": "rgba(255, 255, 255, 0.9)",
"bottom": 0,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
>
<ActivityIndicator
color="#00A94F"
size="large"
/>
<View
<Text
style={
{
"alignItems": "center",
"backgroundColor": "rgba(255, 255, 255, 0.9)",
"bottom": 0,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"color": "#666",
"fontSize": 14,
"marginTop": 12,
}
}
>
<ActivityIndicator
color="#00A94F"
size="large"
/>
<Text
style={
{
"color": "#666",
"fontSize": 14,
"marginTop": 12,
}
}
>
Loading...
</Text>
</View>
Loading...
</Text>
</View>
</RCTSafeAreaView>
</View>
`;
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`GovernanceScreen should match snapshot 1`] = `
<RCTSafeAreaView
<View
style={
{
"backgroundColor": "#FFFFFF",
@@ -12,94 +12,86 @@ exports[`GovernanceScreen should match snapshot 1`] = `
<View
style={
{
"alignItems": "center",
"backgroundColor": "#FFFFFF",
"flex": 1,
"borderBottomColor": "#E0E0E0",
"borderBottomWidth": 1,
"flexDirection": "row",
"justifyContent": "space-between",
"paddingHorizontal": 16,
"paddingVertical": 12,
}
}
>
<View
<Text
style={
{
"alignItems": "center",
"backgroundColor": "#FFFFFF",
"borderBottomColor": "#E0E0E0",
"borderBottomWidth": 1,
"flexDirection": "row",
"justifyContent": "space-between",
"paddingHorizontal": 16,
"paddingVertical": 12,
"color": "#000",
"flex": 1,
"fontSize": 18,
"fontWeight": "700",
"textAlign": "center",
}
}
>
Governance
</Text>
<View
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
{
"opacity": 1,
"padding": 8,
}
}
>
<Text
style={
{
"color": "#000",
"flex": 1,
"fontSize": 18,
"fontWeight": "700",
"textAlign": "center",
"color": "#00A94F",
"fontSize": 14,
"fontWeight": "600",
}
}
>
Governance
Reload
</Text>
<View
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
{
"opacity": 1,
"padding": 8,
}
}
>
<Text
style={
{
"color": "#00A94F",
"fontSize": 14,
"fontWeight": "600",
}
}
>
Reload
</Text>
</View>
</View>
<WebView
allowsBackForwardNavigationGestures={true}
allowsInlineMediaPlayback={true}
bounces={true}
cacheEnabled={true}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}
injectedJavaScript="
</View>
<WebView
allowsBackForwardNavigationGestures={true}
allowsInlineMediaPlayback={true}
bounces={true}
cacheEnabled={true}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}
injectedJavaScript="
(function() {
// Mark this as mobile app
window.PEZKUWI_MOBILE = true;
@@ -109,6 +101,36 @@ exports[`GovernanceScreen should match snapshot 1`] = `
window.PEZKUWI_ADDRESS = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
window.PEZKUWI_ACCOUNT_NAME = 'Mobile Wallet';
// Inject auth session for automatic login
window.PEZKUWI_USER_ID = 'test-user-id';
window.PEZKUWI_USER_EMAIL = 'test@pezkuwichain.io';
// Auto-authenticate with Supabase if session token exists
if (window.PEZKUWI_SESSION_TOKEN) {
(function autoAuth(attempts = 0) {
if (attempts > 50) {
console.warn('[Mobile] Auto-auth timed out: window.supabase not found');
return;
}
if (window.supabase && window.supabase.auth) {
window.supabase.auth.setSession({
access_token: window.PEZKUWI_SESSION_TOKEN,
refresh_token: window.PEZKUWI_REFRESH_TOKEN || ''
}).then(function(res) {
if (res.error) console.warn('[Mobile] Auto-auth error:', res.error);
else console.log('[Mobile] Auto-authenticated successfully');
}).catch(function(err) {
console.warn('[Mobile] Auto-auth promise failed:', err);
});
} else {
setTimeout(function() { autoAuth(attempts + 1); }, 100);
}
})(0);
}
// Override console.log to send to React Native (for debugging)
const originalConsoleLog = console.log;
console.log = function(...args) {
@@ -166,66 +188,65 @@ exports[`GovernanceScreen should match snapshot 1`] = `
true; // Required for injectedJavaScript
})();
"
javaScriptEnabled={true}
mediaPlaybackRequiresUserAction={false}
onError={[Function]}
onHttpError={[Function]}
onLoadEnd={[Function]}
onLoadStart={[Function]}
onMessage={[Function]}
onNavigationStateChange={[Function]}
pullToRefreshEnabled={true}
ref={
{
"current": null,
}
javaScriptEnabled={true}
mediaPlaybackRequiresUserAction={false}
onError={[Function]}
onHttpError={[Function]}
onLoadEnd={[Function]}
onLoadStart={[Function]}
onMessage={[Function]}
onNavigationStateChange={[Function]}
pullToRefreshEnabled={true}
ref={
{
"current": null,
}
sharedCookiesEnabled={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={true}
source={
{
"uri": "https://pezkuwichain.io/elections",
}
}
sharedCookiesEnabled={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={true}
source={
{
"uri": "https://pezkuwichain.io/elections",
}
style={
{
"flex": 1,
}
}
style={
{
"flex": 1,
}
thirdPartyCookiesEnabled={true}
webviewDebuggingEnabled={true}
}
thirdPartyCookiesEnabled={true}
webviewDebuggingEnabled={true}
/>
<View
style={
{
"alignItems": "center",
"backgroundColor": "rgba(255, 255, 255, 0.9)",
"bottom": 0,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
>
<ActivityIndicator
color="#00A94F"
size="large"
/>
<View
<Text
style={
{
"alignItems": "center",
"backgroundColor": "rgba(255, 255, 255, 0.9)",
"bottom": 0,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"color": "#666",
"fontSize": 14,
"marginTop": 12,
}
}
>
<ActivityIndicator
color="#00A94F"
size="large"
/>
<Text
style={
{
"color": "#666",
"fontSize": 14,
"marginTop": 12,
}
}
>
Loading...
</Text>
</View>
Loading...
</Text>
</View>
</RCTSafeAreaView>
</View>
`;
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`P2PScreen should match snapshot 1`] = `
<RCTSafeAreaView
<View
style={
{
"backgroundColor": "#FFFFFF",
@@ -12,94 +12,86 @@ exports[`P2PScreen should match snapshot 1`] = `
<View
style={
{
"alignItems": "center",
"backgroundColor": "#FFFFFF",
"flex": 1,
"borderBottomColor": "#E0E0E0",
"borderBottomWidth": 1,
"flexDirection": "row",
"justifyContent": "space-between",
"paddingHorizontal": 16,
"paddingVertical": 12,
}
}
>
<View
<Text
style={
{
"alignItems": "center",
"backgroundColor": "#FFFFFF",
"borderBottomColor": "#E0E0E0",
"borderBottomWidth": 1,
"flexDirection": "row",
"justifyContent": "space-between",
"paddingHorizontal": 16,
"paddingVertical": 12,
"color": "#000",
"flex": 1,
"fontSize": 18,
"fontWeight": "700",
"textAlign": "center",
}
}
>
P2P Trading
</Text>
<View
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
{
"opacity": 1,
"padding": 8,
}
}
>
<Text
style={
{
"color": "#000",
"flex": 1,
"fontSize": 18,
"fontWeight": "700",
"textAlign": "center",
"color": "#00A94F",
"fontSize": 14,
"fontWeight": "600",
}
}
>
P2P Trading
Reload
</Text>
<View
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": undefined,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
{
"opacity": 1,
"padding": 8,
}
}
>
<Text
style={
{
"color": "#00A94F",
"fontSize": 14,
"fontWeight": "600",
}
}
>
Reload
</Text>
</View>
</View>
<WebView
allowsBackForwardNavigationGestures={true}
allowsInlineMediaPlayback={true}
bounces={true}
cacheEnabled={true}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}
injectedJavaScript="
</View>
<WebView
allowsBackForwardNavigationGestures={true}
allowsInlineMediaPlayback={true}
bounces={true}
cacheEnabled={true}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}
injectedJavaScript="
(function() {
// Mark this as mobile app
window.PEZKUWI_MOBILE = true;
@@ -109,6 +101,36 @@ exports[`P2PScreen should match snapshot 1`] = `
window.PEZKUWI_ADDRESS = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
window.PEZKUWI_ACCOUNT_NAME = 'Mobile Wallet';
// Inject auth session for automatic login
window.PEZKUWI_USER_ID = 'test-user-id';
window.PEZKUWI_USER_EMAIL = 'test@pezkuwichain.io';
// Auto-authenticate with Supabase if session token exists
if (window.PEZKUWI_SESSION_TOKEN) {
(function autoAuth(attempts = 0) {
if (attempts > 50) {
console.warn('[Mobile] Auto-auth timed out: window.supabase not found');
return;
}
if (window.supabase && window.supabase.auth) {
window.supabase.auth.setSession({
access_token: window.PEZKUWI_SESSION_TOKEN,
refresh_token: window.PEZKUWI_REFRESH_TOKEN || ''
}).then(function(res) {
if (res.error) console.warn('[Mobile] Auto-auth error:', res.error);
else console.log('[Mobile] Auto-authenticated successfully');
}).catch(function(err) {
console.warn('[Mobile] Auto-auth promise failed:', err);
});
} else {
setTimeout(function() { autoAuth(attempts + 1); }, 100);
}
})(0);
}
// Override console.log to send to React Native (for debugging)
const originalConsoleLog = console.log;
console.log = function(...args) {
@@ -166,66 +188,65 @@ exports[`P2PScreen should match snapshot 1`] = `
true; // Required for injectedJavaScript
})();
"
javaScriptEnabled={true}
mediaPlaybackRequiresUserAction={false}
onError={[Function]}
onHttpError={[Function]}
onLoadEnd={[Function]}
onLoadStart={[Function]}
onMessage={[Function]}
onNavigationStateChange={[Function]}
pullToRefreshEnabled={true}
ref={
{
"current": null,
}
javaScriptEnabled={true}
mediaPlaybackRequiresUserAction={false}
onError={[Function]}
onHttpError={[Function]}
onLoadEnd={[Function]}
onLoadStart={[Function]}
onMessage={[Function]}
onNavigationStateChange={[Function]}
pullToRefreshEnabled={true}
ref={
{
"current": null,
}
sharedCookiesEnabled={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={true}
source={
{
"uri": "https://pezkuwichain.io/p2p",
}
}
sharedCookiesEnabled={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={true}
source={
{
"uri": "https://pezkuwichain.io/p2p",
}
style={
{
"flex": 1,
}
}
style={
{
"flex": 1,
}
thirdPartyCookiesEnabled={true}
webviewDebuggingEnabled={true}
}
thirdPartyCookiesEnabled={true}
webviewDebuggingEnabled={true}
/>
<View
style={
{
"alignItems": "center",
"backgroundColor": "rgba(255, 255, 255, 0.9)",
"bottom": 0,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
>
<ActivityIndicator
color="#00A94F"
size="large"
/>
<View
<Text
style={
{
"alignItems": "center",
"backgroundColor": "rgba(255, 255, 255, 0.9)",
"bottom": 0,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"color": "#666",
"fontSize": 14,
"marginTop": 12,
}
}
>
<ActivityIndicator
color="#00A94F"
size="large"
/>
<Text
style={
{
"color": "#666",
"fontSize": 14,
"marginTop": 12,
}
}
>
Loading...
</Text>
</View>
Loading...
</Text>
</View>
</RCTSafeAreaView>
</View>
`;
+16
View File
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"types": ["jest", "node"]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"__mocks__/**/*.ts",
"__mocks__/**/*.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
]
}