/** * @module test-types * * Type definitions for test helper infrastructure. * Supports fluent chaining pattern for sync tests. */ import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs'; import { IbGibAddr } from '@ibgib/ts-gib/dist/types.mjs'; import { IbGibSpaceAny } from './witness/space/space-base-v1.mjs'; import { MetaspaceService } from './witness/space/metaspace/metaspace-types.mjs'; /** * Information returned from a mut8 operation. * Captures what was mutated for later verification. */ export interface TestMut8Info { type: 'mut8'; /** * The resulting ib after mutation */ ib: string; /** * The data field key that was added/modified * e.g., "testField_1", "testField_2" * Optional - may be undefined for ib-only mutations */ key?: string; /** * The value that was set to the field * Optional - may be undefined for ib-only mutations */ value?: string; } /** * Information returned from a rel8 operation. * Captures what relation was added for later verification. */ export interface TestRel8Info { type: 'rel8'; /** * The resulting ib after relation...THIS DOES NOT EXIST ATOW. * I need to implement the ability to mut8 the ib when doing a rel8 * transform. This property is questionable right now. */ ib: string; /** * The rel8n name that was used * e.g., "testrel8n_1", "testrel8n_2" */ rel8nName: string; /** * The addresses of ibgibs that were related */ targetAddrs: string[]; } /** * Aggregated information about test operations. * Supports fluent chaining of mut8 and rel8 calls. * * Usage: * ```typescript * const transformer = new TestTransformer(); * let step = await transformer.mut8({ ibGib: alpha, space, metaspace }); * step = await transformer.rel8({ stepInfo: step, targetIbGibs: [beta] }); * step = await transformer.mut8({ stepInfo: step }); * * // Verify all operations * const mut8Info = step.infos[0] as TestMut8Info; * iReckon(sir, step.ibGib.data[mut8Info.key]).isGonnaBe(mut8Info.value); * ``` */ export interface TestStepInfo { /** * The current ibGib after all operations */ ibGib: IbGib_V1; /** * addr of {@link ibGib} */ addr: IbGibAddr; /** * The space this test operates in */ space: IbGibSpaceAny; /** * Metaspace for timeline operations */ metaspace: MetaspaceService; /** * Array of operation infos in order executed */ infos: (TestMut8Info | TestRel8Info)[]; /** * Optional naming context using test convention: * round_timeline_version_location_comments * e.g., "r1_alpha_v2_source_rel8beta" */ name?: string; } /** * Represents a test round grouping related operations. */ export interface TestRound { name: string; description?: string; steps: TestStepInfo[]; }