clone-url-converter
Version:
A simple npm/yarn package for converting GitHub's Http/Https clone links to SSH format and vice versa.
17 lines (14 loc) • 644 B
JavaScript
const { convert } = require('../index');
test('converts https clone URL to SSH', () => {
const httpsLink = 'https://github.com/username/repo.git';
const sshLink = convert(httpsLink);
expect(sshLink).toBe('git@github.com:username/repo.git');
});
test('converts SSH clone URL to https', () => {
const sshLink = 'git@github.com:username/repo.git';
const httpsLink = convert(sshLink);
expect(httpsLink).toBe('https://github.com/username/repo.git');
});
test('throws error for invalid URL', () => {
expect(() => convert('invalid-url')).toThrow('Invalid string input for the method: convertString in package httptosshconverter');
});