"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerPrimitiveAssertSteps = registerPrimitiveAssertSteps;
function registerPrimitiveAssertSteps(registry) {
    registry.register("assert.equals", async (_ctx, step) => {
        const input = (step.with ?? {});
        if (!("actual" in input)) {
            throw new Error('Missing "actual" in step.with for op "assert.equals"');
        }
        if (!("expected" in input)) {
            throw new Error('Missing "expected" in step.with for op "assert.equals"');
        }
        if (input.actual !== input.expected) {
            throw new Error(`Expected values to be equal. Actual: ${String(input.actual)}, Expected: ${String(input.expected)}`);
        }
    });
    registry.register("assert.contains", async (_ctx, step) => {
        const input = (step.with ?? {});
        if (!input.actual) {
            throw new Error('Missing "actual" in step.with for op "assert.contains"');
        }
        if (input.expected === undefined) {
            throw new Error('Missing "expected" in step.with for op "assert.contains"');
        }
        if (!input.actual.includes(input.expected)) {
            throw new Error(`Expected "${input.actual}" to contain "${input.expected}"`);
        }
    });
    registry.register("assert.matches", async (_ctx, step) => {
        const input = (step.with ?? {});
        if (!input.actual) {
            throw new Error('Missing "actual" in step.with for op "assert.matches"');
        }
        if (!input.pattern) {
            throw new Error('Missing "pattern" in step.with for op "assert.matches"');
        }
        const regex = new RegExp(input.pattern);
        if (!regex.test(input.actual)) {
            throw new Error(`Expected "${input.actual}" to match /${input.pattern}/`);
        }
    });
}
//# sourceMappingURL=primitives.step.js.map