UNPKG

tsonik

Version:

A TypeScript client library for the Iconik API based on Swagger documentation

68 lines 2.27 kB
/** * Shared utilities for integration tests * Provides reliable test data setup and cleanup */ import { Tsonik } from '../client'; import { Asset } from '../types'; /** * Test environment configuration */ export interface TestConfig { baseUrl: string; appId: string; authToken: string; } /** * Test data that gets created and cleaned up */ export interface TestData { client: Tsonik; testAsset: Asset; testAssetId: string; createdAssetIds: string[]; createdFormatIds: string[]; createdFilesetIds: string[]; createdFileIds: string[]; createdCollectionIds: string[]; } /** * Get test configuration from environment variables * Throws error if not properly configured */ export declare function getTestConfig(): TestConfig; /** * Create a test client */ export declare function createTestClient(config: TestConfig): Tsonik; /** * Create a test asset for use in integration tests */ export declare function createTestAsset(client: Tsonik, title?: string): Promise<Asset>; /** * Setup test data for integration tests * Creates necessary test assets and returns TestData object */ export declare function setupTestData(customTitle?: string): Promise<TestData>; /** * Cleanup test data * Attempts to delete all created resources */ export declare function cleanupTestData(testData: TestData): Promise<void>; /** * Ensure test environment is ready * Validates that we can connect and perform basic operations */ export declare function validateTestEnvironment(client: Tsonik): Promise<void>; /** * Wrapper for integration tests that handles setup and cleanup */ export declare function withTestData<T>(testFn: (testData: TestData) => Promise<T>, customTitle?: string): Promise<T>; /** * Add tracking for created resources */ export declare function trackCreatedFormat(testData: TestData, formatId: string): void; export declare function trackCreatedFileset(testData: TestData, filesetId: string): void; export declare function trackCreatedFile(testData: TestData, fileId: string): void; export declare function trackCreatedCollection(testData: TestData, collectionId: string): void; export declare function trackCreatedAsset(testData: TestData, assetId: string): void; //# sourceMappingURL=test-utils.d.ts.map