@platform/cell.schema
Version:
URI and database schemas for the `cell.os`.
39 lines (38 loc) • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var test_1 = require("../test");
var _1 = require(".");
var Schema_1 = require("../Schema");
describe('FileSchema', function () {
it('exposed from Schema (static)', function () {
(0, test_1.expect)(Schema_1.Schema.File).to.equal(_1.FileSchema);
(0, test_1.expect)(Schema_1.Schema.File.Links).to.equal(_1.FileLinks);
});
it('uri', function () {
var path = 'NS/foo/FILE/filename';
(0, test_1.expect)(_1.FileSchema.uri({ path: path })).to.eql('file:foo:filename');
});
it('uri (throws)', function () {
var test = function (path) {
var fn = function () { return _1.FileSchema.uri({ path: path }); };
(0, test_1.expect)(fn).to.throw();
};
test('/foo/filename');
test('NS/foo/filename');
test('BOO/foo/FILE/filename');
});
it('toFileLocation', function () {
var test = function (input, expected) {
var res = _1.FileSchema.toFileLocation(input);
(0, test_1.expect)(res).to.eql(expected);
};
test(undefined, 'file://');
test('', 'file://');
test(' ', 'file://');
test('/foo', 'file:///foo');
test(' /foo ', 'file:///foo');
test('http://foo', 'http://foo');
test('https://foo', 'https://foo');
test(' https://foo ', 'https://foo');
});
});