gitly
Version:
An API to download and/or extract git repositories
29 lines (28 loc) • 1.29 kB
JavaScript
;
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 exists_1 = __importDefault(require("../exists"));
describe('utils/exists', () => {
const options = {
temp: (0, node_path_1.join)(__dirname, 'fixtures'),
};
it('should return true when a path exists', async () => {
const result = await (0, exists_1.default)((0, node_path_1.join)(__dirname, 'fixtures', 'test.txt'));
expect(result).toBe(true);
});
it('should return false when a path does not exist', async () => {
const result = await (0, exists_1.default)((0, node_path_1.join)(__dirname, 'fixtures', 'dummy'));
expect(result).toBe(false);
});
it('should return true when a non absolute path exists', async () => {
const result = await (0, exists_1.default)('iwatakeshi/test', options);
expect(result).toBe(true);
});
it('should return false when a non absolute path does not exists', async () => {
const result = await (0, exists_1.default)('iwatakeshi/myrepo', options);
expect(result).toBe(false);
});
});