mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
SELF-1060: Move passport-reader (#1349)
* rm passport-reader * update CI scripts * yarn nice * update android workflow files * ignore leaks * fix write access error * ignore passport read build.gradle file * update message condition * fix read access * revert earlier changes. the failures were do to token permissions * fix wasm test * update jest * fix tests * simplify tests to avoid oom issues * fix tests * fix notification test * fix nfcScanner tests --------- Co-authored-by: Justin Hernandez <justin.hernandez@self.xyz>
This commit is contained in:
@@ -6,21 +6,19 @@ import React from 'react';
|
||||
import { Text } from 'react-native';
|
||||
import { render } from '@testing-library/react-native';
|
||||
|
||||
const mockTrackNfcEvent = jest.fn();
|
||||
const mockFlushAllAnalytics = jest.fn();
|
||||
import ErrorBoundary from '@/components/ErrorBoundary';
|
||||
import { captureException } from '@/Sentry';
|
||||
import { flushAllAnalytics, trackNfcEvent } from '@/utils/analytics';
|
||||
|
||||
jest.doMock('@/utils/analytics', () => ({
|
||||
trackNfcEvent: mockTrackNfcEvent,
|
||||
flushAllAnalytics: mockFlushAllAnalytics,
|
||||
jest.mock('@/utils/analytics', () => ({
|
||||
trackNfcEvent: jest.fn(),
|
||||
flushAllAnalytics: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('@/Sentry', () => ({
|
||||
captureException: jest.fn(),
|
||||
}));
|
||||
|
||||
// Import after mocks are set up
|
||||
const ErrorBoundary = require('@/components/ErrorBoundary').default;
|
||||
const { captureException } = require('@/Sentry');
|
||||
|
||||
const ProblemChild = () => {
|
||||
throw new Error('boom');
|
||||
};
|
||||
@@ -82,11 +80,11 @@ describe('ErrorBoundary', () => {
|
||||
);
|
||||
|
||||
consoleError.mockRestore();
|
||||
expect(mockTrackNfcEvent).toHaveBeenCalledWith('error_boundary', {
|
||||
expect(trackNfcEvent).toHaveBeenCalledWith('error_boundary', {
|
||||
message: 'boom',
|
||||
stack: expect.any(String),
|
||||
});
|
||||
expect(mockFlushAllAnalytics).toHaveBeenCalled();
|
||||
expect(flushAllAnalytics).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('renders children normally when no error occurs', () => {
|
||||
|
||||
@@ -16,17 +16,17 @@ jest.mock('@react-navigation/native', () => ({
|
||||
// Mock Tamagui components to avoid theme provider requirement
|
||||
jest.mock('tamagui', () => {
|
||||
const ReactMock = require('react');
|
||||
const { View: RNView, Text: RNText } = require('react-native');
|
||||
// Use React.createElement directly instead of requiring react-native to avoid memory issues
|
||||
const YStack = ReactMock.forwardRef(({ children, ...props }: any, ref: any) =>
|
||||
ReactMock.createElement(RNView, { ref, ...props }, children),
|
||||
ReactMock.createElement('View', { ref, ...props }, children),
|
||||
);
|
||||
YStack.displayName = 'YStack';
|
||||
const Text = ReactMock.forwardRef(({ children, ...props }: any, ref: any) =>
|
||||
ReactMock.createElement(RNText, { ref, ...props }, children),
|
||||
ReactMock.createElement('Text', { ref, ...props }, children),
|
||||
);
|
||||
Text.displayName = 'Text';
|
||||
const View = ReactMock.forwardRef(({ children, ...props }: any, ref: any) =>
|
||||
ReactMock.createElement(RNView, { ref, ...props }, children),
|
||||
ReactMock.createElement('View', { ref, ...props }, children),
|
||||
);
|
||||
View.displayName = 'View';
|
||||
return {
|
||||
|
||||
@@ -22,9 +22,9 @@ jest.mock('@react-navigation/native', () => ({
|
||||
|
||||
jest.mock('react-native-webview', () => {
|
||||
const ReactMock = require('react');
|
||||
const { View } = require('react-native');
|
||||
// Use React.createElement directly instead of requiring react-native to avoid memory issues
|
||||
const MockWebView = ReactMock.forwardRef((props: any, _ref) => {
|
||||
return ReactMock.createElement(View, { testID: 'webview', ...props });
|
||||
return ReactMock.createElement('View', { testID: 'webview', ...props });
|
||||
});
|
||||
MockWebView.displayName = 'MockWebView';
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user