UNPKG

gitly

Version:

An API to download and/or extract git repositories

35 lines (34 loc) 1.45 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const node_path_1 = require("node:path"); const gitly_1 = __importDefault(require("../gitly")); const exists_1 = __importDefault(require("../exists")); const shelljs_1 = require("shelljs"); describe('gitly', () => { const destination = (0, node_path_1.join)(__dirname, 'output', 'gitly'); const options = { temp: (0, node_path_1.join)(__dirname, 'output', 'gitly'), }; beforeEach(() => { (0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'gitly')); }); afterEach(() => { (0, shelljs_1.rm)('-rf', destination); }); it('should clone the repository using axios', async () => { const result = await (0, gitly_1.default)('lukeed/gittar', destination, options); expect(await (0, exists_1.default)(result[0])).toBe(true); expect(await (0, exists_1.default)(result[1])).toBe(true); }); it('should clone the repository using git', async () => { const result = await (0, gitly_1.default)('lukeed/gittar', destination, { ...options, backend: 'git', }); expect(await (0, exists_1.default)(result[0])).toBe(true); expect(await (0, exists_1.default)(result[1])).toBe(true); }); });