"use strict";
// Generated by bynkc — do not edit by hand.
// test target: shortener.analytics
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = run;
const shortener_analytics = __importStar(require("./../shortener/analytics.js"));
class AssertionError extends Error {
    location;
    start;
    end;
    constructor(location, start, end) {
        super(`assertion failed at ${location}`);
        this.location = location;
        this.start = start;
        this.end = end;
    }
}
function __bynkAssertionFailure(location, start, end) {
    return new AssertionError(location, start, end);
}
function __bynkAssert(cond, location, start, end) {
    if (!cond) {
        throw __bynkAssertionFailure(location, start, end);
    }
}
function makeTestDeps() {
    return {};
}
async function test_short_code_rejects_too_short_input() {
    try {
        const deps = {};
        const { LongUrl, ShortCode } = shortener_analytics;
        const result = ShortCode.fromString("ab");
        void (((__d) => {
            switch (__d.tag) {
                case "Ok": {
                    return __bynkAssert((false), "offset 158", 158, 163);
                }
                case "Err": {
                    return __bynkAssert((true), "offset 187", 187, 191);
                }
            }
            throw new Error("non-exhaustive match");
        })(result));
        return { pass: true };
    }
    catch (e) {
        if (e instanceof AssertionError) {
            return { pass: false, error: { message: e.message, location: e.location } };
        }
        return { pass: false, error: { message: String(e), location: "unknown" } };
    }
}
async function test_short_code_accepts_valid_input() {
    try {
        const deps = {};
        const { LongUrl, ShortCode } = shortener_analytics;
        const result = ShortCode.fromString("abc123");
        void (((__d) => {
            switch (__d.tag) {
                case "Ok": {
                    return __bynkAssert((true), "offset 334", 334, 338);
                }
                case "Err": {
                    return __bynkAssert((false), "offset 362", 362, 367);
                }
            }
            throw new Error("non-exhaustive match");
        })(result));
        return { pass: true };
    }
    catch (e) {
        if (e instanceof AssertionError) {
            return { pass: false, error: { message: e.message, location: e.location } };
        }
        return { pass: false, error: { message: String(e), location: "unknown" } };
    }
}
async function test_long_url_accepts_a_typical_url() {
    try {
        const deps = {};
        const { LongUrl, ShortCode } = shortener_analytics;
        const result = LongUrl.fromString("https://example.com/path");
        if (!(result.tag === "Ok")) {
            throw __bynkAssertionFailure("offset 496", 496, 511);
        }
        return { pass: true };
    }
    catch (e) {
        if (e instanceof AssertionError) {
            return { pass: false, error: { message: e.message, location: e.location } };
        }
        return { pass: false, error: { message: String(e), location: "unknown" } };
    }
}
async function run() {
    const results = [];
    results.push({ name: "short code rejects too-short input", ...(await test_short_code_rejects_too_short_input()) });
    results.push({ name: "short code accepts valid input", ...(await test_short_code_accepts_valid_input()) });
    results.push({ name: "long url accepts a typical url", ...(await test_long_url_accepts_a_typical_url()) });
    return results;
}
