58 lines
2.1 KiB
TypeScript
58 lines
2.1 KiB
TypeScript
|
|
/**
|
||
|
|
* @file TokenizationWorkflow.test.ts
|
||
|
|
* @notice Integration tests for tokenization workflow
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
||
|
|
import { TokenizationWorkflow, TokenizationRequest, TokenizationStatus } from '../../orchestration/tokenization/tokenization-workflow';
|
||
|
|
import { ethers } from 'ethers';
|
||
|
|
|
||
|
|
describe('TokenizationWorkflow', () => {
|
||
|
|
let workflow: TokenizationWorkflow;
|
||
|
|
let provider: ethers.Provider;
|
||
|
|
|
||
|
|
beforeAll(() => {
|
||
|
|
const rpcUrl = process.env.CHAIN_138_RPC_URL || 'http://localhost:8545';
|
||
|
|
provider = new ethers.JsonRpcProvider(rpcUrl);
|
||
|
|
|
||
|
|
workflow = new TokenizationWorkflow(
|
||
|
|
rpcUrl,
|
||
|
|
process.env.TOKEN_REGISTRY_ADDRESS || '',
|
||
|
|
[], // ABI would be imported
|
||
|
|
process.env.FIREFLY_API_URL || 'http://localhost:5000',
|
||
|
|
process.env.FABRIC_API_URL || 'http://localhost:7051',
|
||
|
|
process.env.CACTI_API_URL || 'http://localhost:4000'
|
||
|
|
);
|
||
|
|
});
|
||
|
|
|
||
|
|
describe('initiateTokenization', () => {
|
||
|
|
it('should initiate tokenization workflow', async () => {
|
||
|
|
const request: TokenizationRequest = {
|
||
|
|
requestId: 'TEST-001',
|
||
|
|
underlyingAsset: 'EUR',
|
||
|
|
amount: '1000.00',
|
||
|
|
issuer: '0x1234567890123456789012345678901234567890',
|
||
|
|
reserveId: 'RESERVE-EUR-001',
|
||
|
|
regulatoryFlags: {
|
||
|
|
kyc: true,
|
||
|
|
aml: true
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
// Mock the workflow (in production, this would make actual calls)
|
||
|
|
const result = await workflow.initiateTokenization(request);
|
||
|
|
|
||
|
|
expect(result).toBeDefined();
|
||
|
|
expect(result.requestId).toBe(request.requestId);
|
||
|
|
expect(result.status).toBe(TokenizationStatus.COMPLETED);
|
||
|
|
}, 30000);
|
||
|
|
});
|
||
|
|
|
||
|
|
describe('getStatus', () => {
|
||
|
|
it('should get tokenization status', async () => {
|
||
|
|
const status = await workflow.getStatus('TEST-001');
|
||
|
|
expect(status).toBeDefined();
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|