forked from yarnpkg/yarn
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add failing test for issue yarnpkg#5954
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}); |