// Generated by bynkc — do not edit by hand.
// test target: commerce.money

import { Ok, Err, Some, None, type Result, type Option, type ValidationError } from "../runtime.js";
import * as commerce_money from "./../commerce/money.js";

class AssertionError extends Error {
  location: string;
  start: number;
  end: number;
  constructor(location: string, start: number, end: number) {
    super(`assertion failed at ${location}`);
    this.location = location;
    this.start = start;
    this.end = end;
  }
}
function __bynkAssertionFailure(location: string, start: number, end: number) {
  return new AssertionError(location, start, end);
}
function __bynkAssert(cond: boolean, location: string, start: number, end: number): void {
  if (!cond) { throw __bynkAssertionFailure(location, start, end); }
}

function makeTestDeps() {
  return {  };
}

async function test_bare_mock_produces_a_default_valued_quantity() {
  try {
    const deps = {};
    const { Quantity } = commerce_money as any;
    const d = Quantity.unsafe(1);
    if (!(d === d)) { throw __bynkAssertionFailure("tests/money.test.bynk:5:12", 190, 196); }
    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_pinned_mock_takes_the_given_literal() {
  try {
    const deps = {};
    const { Quantity } = commerce_money as any;
    const q = Quantity.unsafe(50);
    if (!(q === q)) { throw __bynkAssertionFailure("tests/money.test.bynk:10:12", 291, 297); }
    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" } };
  }
}

export async function run() {
  const results = [];
  results.push({ name: "bare mock produces a default-valued quantity", ...(await test_bare_mock_produces_a_default_valued_quantity()) });
  results.push({ name: "pinned mock takes the given literal", ...(await test_pinned_mock_takes_the_given_literal()) });
  return results;
}
