Skip to content

Commit

Permalink
add failing test for issue yarnpkg#5954
Browse files Browse the repository at this point in the history
  • Loading branch information
rally25rs committed Jun 9, 2018
1 parent 41040f1 commit 2c98a00
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions __tests__/util/version.js
@@ -0,0 +1,29 @@
/* @flow */

import {explodeHashedUrl} from '../../src/util/version';

describe('getDataDir', () => {
test('correctly separates a url with a hash', () => {
const expectedUrl = 'git+ssh://git@github.com:org/proj.git';
const expectedHash = 'branch'
const {url, hash} = explodeHashedUrl(`${expectedUrl}#${expectedHash}`);
expect(url).toBe(expectedUrl);
expect(hash).toBe(expectedHash);
});

test('returns an empty string as the hash for a url with no hash', () => {
const expectedUrl = 'git+ssh://git@github.com:org/proj.git';
const expectedHash = ''
const {url, hash} = explodeHashedUrl(expectedUrl);
expect(url).toBe(expectedUrl);
expect(hash).toBe(expectedHash);
});

test('correctly separates a url with a hash in the hash', () => {
const expectedUrl = 'git+ssh://git@github.com:org/proj.git';
const expectedHash = 'branch#123'
const {url, hash} = explodeHashedUrl(`${expectedUrl}#${expectedHash}`);
expect(url).toBe(expectedUrl);
expect(hash).toBe(expectedHash);
});
});

0 comments on commit 2c98a00

Please sign in to comment.