"use strict";
///<reference types='./types'/>
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = __importDefault(require("ava"));
const formats_1 = require("@oada/formats");
(async () => {
    var _a, _b;
    for await (const { key, schema } of formats_1.schemas()) {
        const type = key
            .replace(/^https:\/\/formats\.openag\.io/, '')
            .replace(/^\//, './')
            .replace(/\.schema\.json$/, '');
        for (const i in (_a = schema.examples) !== null && _a !== void 0 ? _a : []) {
            const example = (_b = schema.examples) === null || _b === void 0 ? void 0 : _b[i];
            ava_1.default(`${key} should check true for example ${i}`, async (t) => {
                const typeModule = await Promise.resolve().then(() => __importStar(require(type)));
                t.assert(typeModule.is(example));
            });
            ava_1.default(`${key} should assert example ${i}`, async (t) => {
                const typeModule = await Promise.resolve().then(() => __importStar(require(type)));
                try {
                    typeModule.assert(example);
                    t.pass();
                }
                catch (err) {
                    t.fail(err);
                }
            });
        }
    }
})();
//# sourceMappingURL=types.spec.js.map