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:
Seshanth.S
2025-11-12 05:44:32 +05:30
committed by GitHub
parent c7fdf9f791
commit c4dbb902a3
30 changed files with 924 additions and 2008 deletions

View File

@@ -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', () => {

View File

@@ -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 {

View File

@@ -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 {