UNPKG

@0xcert/conventions

Version:

Module with implementation of all confirmed conventions.

31 lines 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const spec_1 = require("@hayspec/spec"); const jsonschema_1 = require("jsonschema"); const _88_crypto_collectible_1 = require("../assets/88-crypto-collectible"); 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, _88_crypto_collectible_1.schema88).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, _88_crypto_collectible_1.schema88).valid); }); exports.default = spec; //# sourceMappingURL=88-base-asset.test.js.map