Files
smom-dbis-138/test/emoney/api/contract/openapi-validation.test.ts
defiQUG 1fb7266469 Add Oracle Aggregator and CCIP Integration
- Introduced Aggregator.sol for Chainlink-compatible oracle functionality, including round-based updates and access control.
- Added OracleWithCCIP.sol to extend Aggregator with CCIP cross-chain messaging capabilities.
- Created .gitmodules to include OpenZeppelin contracts as a submodule.
- Developed a comprehensive deployment guide in NEXT_STEPS_COMPLETE_GUIDE.md for Phase 2 and smart contract deployment.
- Implemented Vite configuration for the orchestration portal, supporting both Vue and React frameworks.
- Added server-side logic for the Multi-Cloud Orchestration Portal, including API endpoints for environment management and monitoring.
- Created scripts for resource import and usage validation across non-US regions.
- Added tests for CCIP error handling and integration to ensure robust functionality.
- Included various new files and directories for the orchestration portal and deployment scripts.
2025-12-12 14:57:48 -08:00

63 lines
1.8 KiB
TypeScript

/**
* OpenAPI Contract Validation Tests
* Ensures API implementation conforms to OpenAPI specification
*/
import { describe, it, expect } from '@jest/globals';
import { readFileSync } from 'fs';
import { join } from 'path';
import * as yaml from 'js-yaml';
import Ajv from 'ajv';
import addFormats from 'ajv-formats';
const OPENAPI_SPEC = join(__dirname, '../../../api/packages/openapi/v1/openapi.yaml');
describe('OpenAPI Contract Validation', () => {
let openapiSpec: any;
beforeAll(() => {
const specContent = readFileSync(OPENAPI_SPEC, 'utf-8');
openapiSpec = yaml.load(specContent);
});
it('should have valid OpenAPI structure', () => {
expect(openapiSpec).toHaveProperty('openapi');
expect(openapiSpec.openapi).toMatch(/^3\.\d+\.\d+$/);
expect(openapiSpec).toHaveProperty('info');
expect(openapiSpec).toHaveProperty('paths');
});
it('should have all required paths', () => {
const requiredPaths = [
'/tokens',
'/tokens/{code}',
'/liens',
'/liens/{lienId}',
'/compliance/accounts/{accountRefId}',
'/triggers',
'/triggers/{triggerId}',
'/iso/inbound',
'/iso/outbound',
'/packets',
'/bridge/lock',
'/bridge/unlock',
];
requiredPaths.forEach((path) => {
expect(openapiSpec.paths).toHaveProperty(path);
});
});
it('should have security schemes defined', () => {
expect(openapiSpec.components).toHaveProperty('securitySchemes');
expect(openapiSpec.components.securitySchemes).toHaveProperty('oauth2');
expect(openapiSpec.components.securitySchemes).toHaveProperty('mtls');
});
it('should have idempotency markers', () => {
expect(openapiSpec).toHaveProperty('x-idempotency');
expect(Array.isArray(openapiSpec['x-idempotency'])).toBe(true);
});
});