@0xcert/conventions
Version:
Module with implementation of all confirmed conventions.
27 lines • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const spec_1 = require("@hayspec/spec");
const jsonschema_1 = require("jsonschema");
const erc721_1 = require("../assets/erc721");
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 = {
'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, erc721_1.schemaErc721).valid);
});
spec.test('fails for valid data', (ctx) => {
const data = {
'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, erc721_1.schemaErc721).valid);
});
exports.default = spec;
//# sourceMappingURL=erc721.test.js.map