Files
self/app/tests/__setup__/selfClientProvider.ts
Justin Hernandez 551067a48e Reorganize mobile app /src and /tests folders (#1357)
* Refactor mobile app utilities into new modules

* prettier

* update lock, feedback from codex

* fix path

* keep some files in utils

* fix tests

* update paths

* remove old docs

* cr feedback

* flatten inefficient paths

* better structure

* update test folder structure

* migrate images

* fix import

* fix Sentry path

* update ignore

* save wip migration

* more updates

* standardize component names

* rename assets

* fix linting

* add barrel exports. final refactor commit

* fix formatting

* fix nav bar

* reduce bundle size

* remove dupe license

* fix test

* fix merge issues

* add refactor doc so we can track what was imporoved

* cr feedback

* feedback
2025-11-20 17:56:44 -03:00

71 lines
1.6 KiB
TypeScript

// SPDX-License-Identifier: BUSL-1.1; Copyright (c) 2025 Social Connect Labs, Inc.; Licensed under BUSL-1.1 (see LICENSE); Apache-2.0 from 2029-06-11
/* eslint-disable sort-exports/sort-exports */
import type {
AuthAdapter,
CryptoAdapter,
DocumentsAdapter,
NetworkAdapter,
NFCScannerAdapter,
} from '@selfxyz/mobile-sdk-alpha';
export const mockCrypto: CryptoAdapter = {
hash: async () => new Uint8Array(),
sign: async () => new Uint8Array(),
};
export const mockDocuments: DocumentsAdapter = {
loadDocumentCatalog: async () => ({ documents: [] }),
loadDocumentById: async () => null,
saveDocumentCatalog: async () => {},
saveDocument: async () => {},
deleteDocument: async () => {},
};
export const mockNetwork: NetworkAdapter = {
http: {
fetch: async () =>
({
ok: true,
status: 200,
text: async () => '',
json: async () => ({}),
arrayBuffer: async () => new ArrayBuffer(0),
}) as any,
},
ws: {
connect: () => ({
send: () => {},
close: () => {},
onMessage: () => {},
onError: () => {},
onClose: () => {},
}),
},
};
export const mockScanner: NFCScannerAdapter = {
scan: async () => ({
mode: 'mrz',
passportNumber: '',
dateOfBirth: '',
dateOfExpiry: '',
passportData: {
mock: true,
} as any,
}),
};
export const mockAuth: AuthAdapter = {
getPrivateKey: async () => '0x-mock-private-key',
};
export const mockAdapters = {
auth: mockAuth,
scanner: mockScanner,
network: mockNetwork,
crypto: mockCrypto,
documents: mockDocuments,
};