-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient-compatibility.test.ts
More file actions
40 lines (36 loc) · 1.21 KB
/
Copy pathclient-compatibility.test.ts
File metadata and controls
40 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { describe, it, expect, vi } from 'vitest';
import { ILNSdk } from './client';
// Mock the compatibility module cleanly to avoid ES module read-only export issues with @stellar/stellar-sdk
vi.mock('./compatibility', () => {
return {
SDK_VERSION: '0.1.0',
MIN_CONTRACT_VERSION: '0.1.0',
checkCompatibility: vi.fn().mockResolvedValue({
compatible: true,
contractVersion: '0.1.0',
sdkVersion: '0.1.0',
issues: [],
}),
};
});
describe('ILNSdk.checkCompatibility (class method)', () => {
it('correctly integrates with ILNSdk simulation', async () => {
const mockSimulate = vi.fn().mockResolvedValue({
result: {
retval: {}, // simulated ScVal return
},
});
const sdk = new ILNSdk({
contractId: 'CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHP4',
networkPassphrase: 'Test SDF Network ; September 2015',
rpcUrl: 'https://soroban-testnet.stellar.org',
server: {
simulateTransaction: mockSimulate,
} as any,
});
const result = await sdk.checkCompatibility();
expect(result.compatible).toBe(true);
expect(result.contractVersion).toBe('0.1.0');
expect(result.issues).toHaveLength(0);
});
});