UNPKG

gitly

Version:

An API to download and/or extract git repositories

30 lines (29 loc) 1.55 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const parse_1 = __importDefault(require("../parse")); const tar_1 = require("../tar"); describe('utils/tar', () => { describe('getUrl()', () => { it('should return a github url to the zipped file', () => { expect((0, tar_1.getUrl)((0, parse_1.default)('iwatakeshi/test'))).toEqual('https://github.com/iwatakeshi/test/archive/master.tar.gz'); }); it('should return a bitbucket url to the zipped file', () => { expect((0, tar_1.getUrl)((0, parse_1.default)('bitbucket:iwatakeshi/test'))).toEqual('https://bitbucket.org/iwatakeshi/test/get/master.tar.gz'); }); it('should return a gitlab url to the zipped file', () => { expect((0, tar_1.getUrl)((0, parse_1.default)('gitlab:iwatakeshi/test'))).toEqual('https://gitlab.com/iwatakeshi/test/-/archive/master/test-master.tar.gz'); }); it('should return a custom url to the zipped file', () => { expect((0, tar_1.getUrl)((0, parse_1.default)('iwatakeshi/test'), { url: { filter(info) { return `https://domain.com${info.path}/repo/archive.tar.gz?ref=${info.type}`; }, }, })).toEqual('https://domain.com/iwatakeshi/test/repo/archive.tar.gz?ref=master'); }); }); });