textiot
Version:
A framework for building web and native (IoT) Dapps on the IPFS network
32 lines (31 loc) • 1.49 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const schema_miller_1 = __importDefault(require("../../helpers/schema-miller"));
// import { Directory } from '../../models'
const simple_1 = require("./__static__/simple");
const hash = 'QMABCDDDKLSFDKLSDFLKSDF34523LKSSDDLFK23LK43K46';
describe('simple schema', () => {
it('should be sorted by dependencies', () => {
const node = simple_1.schema;
const sorted = schema_miller_1.default.sortLinksByDependency(node.links);
expect(sorted[2].name).toEqual('thumb');
});
it.skip('should have normalized options', () => {
const { links: { thumb } } = simple_1.schema;
const node = thumb;
const normalized = schema_miller_1.default.normalizeOptions(node);
expect(normalized.pin).toEqual(true);
expect(normalized.plaintext).toEqual(false);
});
// it('should have resolved use', () => {
// const { links: { large, thumb } } = response
// const payloadsByName: Directory = { files: { large: { hash } } }
// const resolvedOne = SchemaMiller.resolveDependency(large, payloadsByName)
// const resolvedTwo = SchemaMiller.resolveDependency(thumb, payloadsByName)
// expect(resolvedOne.opts.use).toEqual(hash)
// expect(resolvedTwo.opts.use).toEqual(hash)
// })
});
;