build: enlever import dynamique de Services (sp-address) pour supprimer warning Vite; tests: mock Services dans sp-address utils
This commit is contained in:
parent
857e6f019f
commit
62c4c9cb70
5
docs/COMMUNITY_GUIDE.md
Normal file
5
docs/COMMUNITY_GUIDE.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Guide de la communauté - ihm_client
|
||||||
|
|
||||||
|
- Comment contribuer (issues, PR, revues)
|
||||||
|
- Standards de code et de documentation
|
||||||
|
- Processus de release et de support
|
@ -1,12 +1,4 @@
|
|||||||
// Importer dynamiquement les services pour éviter les dépendances lourdes lors des tests Jest
|
import Services from '../services/service';
|
||||||
let ServicesLazy: any | null = null;
|
|
||||||
async function getServices() {
|
|
||||||
if (!ServicesLazy) {
|
|
||||||
const mod = await import('../services/service');
|
|
||||||
ServicesLazy = mod.default;
|
|
||||||
}
|
|
||||||
return ServicesLazy as any;
|
|
||||||
}
|
|
||||||
import { getCorrectDOM } from './html.utils';
|
import { getCorrectDOM } from './html.utils';
|
||||||
import { addSubscription } from './subscription.utils';
|
import { addSubscription } from './subscription.utils';
|
||||||
import QRCode from 'qrcode';
|
import QRCode from 'qrcode';
|
||||||
@ -160,7 +152,6 @@ export function initAddressInput() {
|
|||||||
async function onCreateButtonClick() {
|
async function onCreateButtonClick() {
|
||||||
try {
|
try {
|
||||||
await prepareAndSendPairingTx();
|
await prepareAndSendPairingTx();
|
||||||
const Services = await getServices();
|
|
||||||
const service = await Services.getInstance();
|
const service = await Services.getInstance();
|
||||||
await service.confirmPairing();
|
await service.confirmPairing();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -169,7 +160,6 @@ async function onCreateButtonClick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function prepareAndSendPairingTx(): Promise<void> {
|
export async function prepareAndSendPairingTx(): Promise<void> {
|
||||||
const Services = await getServices();
|
|
||||||
const service = await Services.getInstance();
|
const service = await Services.getInstance();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
// Mock Services to éviter les imports lourds (router/token/jose) lors de ces tests
|
||||||
|
jest.mock('../../src/services/service', () => {
|
||||||
|
class ServicesMock {
|
||||||
|
static async getInstance() { return new ServicesMock(); }
|
||||||
|
}
|
||||||
|
return { __esModule: true, default: ServicesMock };
|
||||||
|
});
|
||||||
import { generateEmojiList, addressToEmoji } from '../../src/utils/sp-address.utils';
|
import { generateEmojiList, addressToEmoji } from '../../src/utils/sp-address.utils';
|
||||||
|
|
||||||
describe('sp-address.utils', () => {
|
describe('sp-address.utils', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user