Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f43a22c
add document selector test screen
transphorm Jan 6, 2026
bbe4aa5
clean up mock docs
transphorm Jan 6, 2026
4ad10e6
update selection options
transphorm Jan 7, 2026
1e3386f
Merge branch 'dev' into justin/self-1754-proving-screen-selective-dis…
transphorm Jan 7, 2026
a63f3ad
Merge branch 'dev' into justin/self-1754-proving-screen-selective-dis…
transphorm Jan 7, 2026
d28cf5a
Add DocumentSelectorForProving screen and route proof flows through i…
transphorm Jan 8, 2026
a6d4548
remove not accepted state
transphorm Jan 8, 2026
191acca
save wip design
transphorm Jan 8, 2026
3e7d6c6
formatting
transphorm Jan 8, 2026
b5ef1fd
update design
transphorm Jan 8, 2026
4b45e2a
update layout
transphorm Jan 8, 2026
a54374a
Update proving flow tests (#1559)
transphorm Jan 8, 2026
99d200e
Refactor ProveScreen to ProofRequestCard layout and preserve scroll p…
transphorm Jan 8, 2026
edac83b
wip fix tests
transphorm Jan 8, 2026
8ea959d
fix tests
transphorm Jan 8, 2026
bacd36b
formatting
transphorm Jan 8, 2026
69e7523
agent feedback
transphorm Jan 8, 2026
fccb65c
fix tests
transphorm Jan 8, 2026
128b4fa
Merge branch 'dev' into justin/self-1754-proving-screen-selective-dis…
transphorm Jan 8, 2026
e54ba03
save wip
transphorm Jan 8, 2026
e7f8411
remove text
transphorm Jan 8, 2026
2324023
fix types
transphorm Jan 8, 2026
69c65e3
save working header update
transphorm Jan 8, 2026
0fadd1f
no transition
transphorm Jan 8, 2026
5fd9c5f
cache document load for proving flow
transphorm Jan 8, 2026
75d1c7d
save fixes
transphorm Jan 8, 2026
f8b3c65
small fixes
transphorm Jan 9, 2026
7f6d809
match disclosure text
transphorm Jan 9, 2026
cddd454
design updates
transphorm Jan 9, 2026
9128ca0
fix approve flow
transphorm Jan 9, 2026
256fcd8
fix document type flash
transphorm Jan 9, 2026
a472865
add min height so text doesn't jump
transphorm Jan 9, 2026
9c37e85
update lock
transphorm Jan 9, 2026
1cc7951
formatting
transphorm Jan 9, 2026
0d4da72
save refactor wip
transphorm Jan 9, 2026
6cd9d7a
don't enable euclid yet
transphorm Jan 9, 2026
5cf025a
fix tests
transphorm Jan 9, 2026
921c60e
fix staleness check
transphorm Jan 9, 2026
e559aca
fix select box description
transphorm Jan 9, 2026
c387940
remove id selector screen
transphorm Jan 9, 2026
e03508d
vertically center
transphorm Jan 9, 2026
97698a0
button updates
transphorm Jan 9, 2026
0953717
Remove proving document cache (#1567)
transphorm Jan 9, 2026
be9452f
Merge branch 'dev' into justin/self-1754-proving-screen-selective-dis…
transphorm Jan 9, 2026
2526ac2
formatting
transphorm Jan 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
265 changes: 143 additions & 122 deletions app/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,15 @@
}),
PixelRatio: mockPixelRatio,
Dimensions: {
get: jest.fn(() => ({
window: { width: 375, height: 667, scale: 2 },
screen: { width: 375, height: 667, scale: 2 },
})),
get: jest.fn((dimension) => {

Check warning on line 113 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Replace `(dimension)` with `dimension`

Check warning on line 113 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Replace `(dimension)` with `dimension`
const dimensions = {
window: { width: 375, height: 667, scale: 2, fontScale: 1 },
screen: { width: 375, height: 667, scale: 2, fontScale: 1 },
};
return dimension ? dimensions[dimension] : dimensions;
}),
addEventListener: jest.fn(() => ({ remove: jest.fn() })),
removeEventListener: jest.fn(),
},
Linking: {
getInitialURL: jest.fn().mockResolvedValue(null),
Expand All @@ -139,6 +144,7 @@
ScrollView: 'ScrollView',
TouchableOpacity: 'TouchableOpacity',
TouchableHighlight: 'TouchableHighlight',
Pressable: 'Pressable',
Image: 'Image',
ActivityIndicator: 'ActivityIndicator',
SafeAreaView: 'SafeAreaView',
Expand Down Expand Up @@ -273,10 +279,15 @@
Version: 14,
},
Dimensions: {
get: jest.fn(() => ({
window: { width: 375, height: 667, scale: 2 },
screen: { width: 375, height: 667, scale: 2 },
})),
get: jest.fn((dimension) => {

Check warning on line 282 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Replace `(dimension)` with `dimension`

Check warning on line 282 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Replace `(dimension)` with `dimension`
const dimensions = {
window: { width: 375, height: 667, scale: 2, fontScale: 1 },
screen: { width: 375, height: 667, scale: 2, fontScale: 1 },
};
return dimension ? dimensions[dimension] : dimensions;
}),
addEventListener: jest.fn(() => ({ remove: jest.fn() })),
removeEventListener: jest.fn(),
},
StyleSheet: {
create: jest.fn(styles => styles),
Expand Down Expand Up @@ -359,15 +370,18 @@
'../packages/mobile-sdk-alpha/node_modules/react-native/Libraries/Utilities/Dimensions',
() => ({
getConstants: jest.fn(() => ({
window: { width: 375, height: 667, scale: 2 },
screen: { width: 375, height: 667, scale: 2 },
window: { width: 375, height: 667, scale: 2, fontScale: 1 },
screen: { width: 375, height: 667, scale: 2, fontScale: 1 },
})),
set: jest.fn(),
get: jest.fn(() => ({
window: { width: 375, height: 667, scale: 2 },
screen: { width: 375, height: 667, scale: 2 },
})),
addEventListener: jest.fn(),
get: jest.fn((dimension) => {

Check warning on line 377 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Replace `(dimension)` with `dimension`

Check warning on line 377 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Replace `(dimension)` with `dimension`
const dimensions = {
window: { width: 375, height: 667, scale: 2, fontScale: 1 },
screen: { width: 375, height: 667, scale: 2, fontScale: 1 },
};
return dimension ? dimensions[dimension] : dimensions;
}),
addEventListener: jest.fn(() => ({ remove: jest.fn() })),
removeEventListener: jest.fn(),
}),
{ virtual: true },
Expand Down Expand Up @@ -550,122 +564,129 @@
{ virtual: true },
);

// Mock the hooks subpath from mobile-sdk-alpha
jest.mock('@selfxyz/mobile-sdk-alpha/hooks', () => ({
useSafeBottomPadding: jest.fn((basePadding = 20) => basePadding + 50),
}));

// Mock problematic mobile-sdk-alpha components that use React Native StyleSheet
jest.mock('@selfxyz/mobile-sdk-alpha', () => ({
// Override only the specific mocks we need
NFCScannerScreen: jest.fn(() => null),
SelfClientProvider: jest.fn(({ children }) => children),
useSelfClient: jest.fn(() => {
// Create a consistent mock instance for memoization testing
if (!global.mockSelfClientInstance) {
global.mockSelfClientInstance = {
// Mock selfClient object with common methods
connect: jest.fn(),
disconnect: jest.fn(),
isConnected: false,
extractMRZInfo: jest.fn(mrzString => {
// Mock extractMRZInfo with realistic behavior
if (!mrzString || typeof mrzString !== 'string') {
throw new Error('Invalid MRZ string provided');
}

// Valid MRZ example from the test
if (mrzString.includes('L898902C3')) {
return {
documentNumber: 'L898902C3',
validation: {
overall: true,
},
// Add other expected MRZ fields
firstName: 'ANNA',
lastName: 'ERIKSSON',
nationality: 'UTO',
dateOfBirth: '740812',
sex: 'F',
expirationDate: '120415',
};
}
SelfClientProvider: jest.fn(({ children }) => children),

Check warning on line 576 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Delete `··`

Check warning on line 576 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Delete `··`
useSafeBottomPadding: jest.fn((basePadding = 20) => basePadding + 50),

Check warning on line 577 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Delete `··`

Check warning on line 577 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Delete `··`
useSelfClient: jest.fn(() => {

Check warning on line 578 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Delete `··`

Check warning on line 578 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Delete `··`
// Create a consistent mock instance for memoization testing

Check warning on line 579 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Delete `··`

Check warning on line 579 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Delete `··`
if (!global.mockSelfClientInstance) {

Check warning on line 580 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Replace `······` with `····`

Check warning on line 580 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Replace `······` with `····`
global.mockSelfClientInstance = {

Check warning on line 581 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Delete `··`

Check warning on line 581 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Delete `··`
// Mock selfClient object with common methods

Check warning on line 582 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / workspace-lint

Replace `··········` with `········`

Check warning on line 582 in app/jest.setup.js

View workflow job for this annotation

GitHub Actions / build-deps

Replace `··········` with `········`
connect: jest.fn(),
disconnect: jest.fn(),
isConnected: false,
extractMRZInfo: jest.fn(mrzString => {
// Mock extractMRZInfo with realistic behavior
if (!mrzString || typeof mrzString !== 'string') {
throw new Error('Invalid MRZ string provided');
}

// For malformed/invalid MRZ strings, throw an error
throw new Error('Invalid MRZ format');
}),
trackEvent: jest.fn(),
};
}
return global.mockSelfClientInstance;
}),
createSelfClient: jest.fn(() => ({
// Mock createSelfClient return value
connect: jest.fn(),
disconnect: jest.fn(),
isConnected: false,
extractMRZInfo: jest.fn(mrzString => {
// Mock extractMRZInfo with realistic behavior
if (!mrzString || typeof mrzString !== 'string') {
throw new Error('Invalid MRZ string provided');
}
// Valid MRZ example from the test
if (mrzString.includes('L898902C3')) {
return {
documentNumber: 'L898902C3',
validation: {
overall: true,
},
// Add other expected MRZ fields
firstName: 'ANNA',
lastName: 'ERIKSSON',
nationality: 'UTO',
dateOfBirth: '740812',
sex: 'F',
expirationDate: '120415',
};
}

// Valid MRZ example from the test
if (mrzString.includes('L898902C3')) {
return {
documentNumber: 'L898902C3',
validation: {
overall: true,
},
// Add other expected MRZ fields
firstName: 'ANNA',
lastName: 'ERIKSSON',
nationality: 'UTO',
dateOfBirth: '740812',
sex: 'F',
expirationDate: '120415',
// For malformed/invalid MRZ strings, throw an error
throw new Error('Invalid MRZ format');
}),
trackEvent: jest.fn(),
};
}

// For malformed/invalid MRZ strings, throw an error
throw new Error('Invalid MRZ format');
return global.mockSelfClientInstance;
}),
trackEvent: jest.fn(),
})),
createListenersMap: jest.fn(() => ({
// Mock createListenersMap return value
map: new Map(),
addListener: jest.fn(),
removeListener: jest.fn(),
})),
isPassportDataValid: jest.fn((data, callbacks) => {
// Mock validation function with realistic behavior
if (!data || !data.passportMetadata) {
// Call appropriate callbacks for missing data
if (callbacks?.onPassportMetadataNull) {
callbacks.onPassportMetadataNull();
createSelfClient: jest.fn(() => ({
// Mock createSelfClient return value
connect: jest.fn(),
disconnect: jest.fn(),
isConnected: false,
extractMRZInfo: jest.fn(mrzString => {
// Mock extractMRZInfo with realistic behavior
if (!mrzString || typeof mrzString !== 'string') {
throw new Error('Invalid MRZ string provided');
}

// Valid MRZ example from the test
if (mrzString.includes('L898902C3')) {
return {
documentNumber: 'L898902C3',
validation: {
overall: true,
},
// Add other expected MRZ fields
firstName: 'ANNA',
lastName: 'ERIKSSON',
nationality: 'UTO',
dateOfBirth: '740812',
sex: 'F',
expirationDate: '120415',
};
}

// For malformed/invalid MRZ strings, throw an error
throw new Error('Invalid MRZ format');
}),
trackEvent: jest.fn(),
})),
createListenersMap: jest.fn(() => ({
// Mock createListenersMap return value
map: new Map(),
addListener: jest.fn(),
removeListener: jest.fn(),
})),
isPassportDataValid: jest.fn((data, callbacks) => {
// Mock validation function with realistic behavior
if (!data || !data.passportMetadata) {
// Call appropriate callbacks for missing data
if (callbacks?.onPassportMetadataNull) {
callbacks.onPassportMetadataNull();
}
return false;
}
return false;
}
// Return true for valid data, false for invalid
return data.valid !== false;
}),
SdkEvents: {
// Mock SDK events object
PROVING_PASSPORT_DATA_NOT_FOUND: 'PROVING_PASSPORT_DATA_NOT_FOUND',
PROVING_STARTED: 'PROVING_STARTED',
PROVING_COMPLETED: 'PROVING_COMPLETED',
PROVING_FAILED: 'PROVING_FAILED',
// Add other events as needed
},
// Mock haptic functions
buttonTap: jest.fn(),
cancelTap: jest.fn(),
confirmTap: jest.fn(),
feedbackProgress: jest.fn(),
feedbackSuccess: jest.fn(),
feedbackUnsuccessful: jest.fn(),
impactLight: jest.fn(),
impactMedium: jest.fn(),
loadingScreenProgress: jest.fn(),
notificationError: jest.fn(),
notificationSuccess: jest.fn(),
notificationWarning: jest.fn(),
selectionChange: jest.fn(),
// Return true for valid data, false for invalid
return data.valid !== false;
}),
SdkEvents: {
// Mock SDK events object
PROVING_PASSPORT_DATA_NOT_FOUND: 'PROVING_PASSPORT_DATA_NOT_FOUND',
PROVING_STARTED: 'PROVING_STARTED',
PROVING_COMPLETED: 'PROVING_COMPLETED',
PROVING_FAILED: 'PROVING_FAILED',
// Add other events as needed
},
// Mock haptic functions
buttonTap: jest.fn(),
cancelTap: jest.fn(),
confirmTap: jest.fn(),
feedbackProgress: jest.fn(),
feedbackSuccess: jest.fn(),
feedbackUnsuccessful: jest.fn(),
impactLight: jest.fn(),
impactMedium: jest.fn(),
loadingScreenProgress: jest.fn(),
notificationError: jest.fn(),
notificationSuccess: jest.fn(),
notificationWarning: jest.fn(),
selectionChange: jest.fn(),
triggerFeedback: jest.fn(),
// Add other components and hooks as needed
}));
Expand Down
Loading
Loading