UNPKG

@0xcert/conventions

Version:

Module with implementation of all confirmed conventions.

31 lines 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const spec_1 = require("@hayspec/spec"); const jsonschema_1 = require("jsonschema"); const _86_base_asset_1 = require("../assets/86-base-asset"); const spec = new spec_1.Spec(); spec.before((stage) => { stage.set('validator', new jsonschema_1.Validator()); }); spec.test('passes for valid data', (ctx) => { const data = { '$evidence': 'https://troopersgame.com/dog/evidence', '$schema': 'http://json-schema.org/draft-07/schema', 'description': 'A weapon for the Troopers game which can severely injure the enemy.', 'image': 'https://troopersgame.com/dog.jpg', 'name': 'Troopers game', }; ctx.true(ctx.get('validator').validate(data, _86_base_asset_1.schema86).valid); }); spec.test('fails for valid data', (ctx) => { const data = { '$evidence': 'https://troopersgame.com/dog/evidence', '$schema': 'http://json-schema.org/draft-07/schema', 'description': 'A weapon for the Troopers game which can severely injure the enemy.', 'image': 'https://troopersgame.com/dog.jpg', 'name': 12, }; ctx.false(ctx.get('validator').validate(data, _86_base_asset_1.schema86).valid); }); exports.default = spec; //# sourceMappingURL=86-base-asset.test.js.map