forked from sombochea/verdaccio-ui
test: add unit test for extractFileName
This commit is contained in:
parent
f47ab2490b
commit
12974ea54f
@ -1,5 +1,6 @@
|
|||||||
import { isURL, isEmail, getRegistryURL } from './url';
|
import { isURL, isEmail, getRegistryURL, extractFileName } from './url';
|
||||||
|
|
||||||
|
describe('utils', () => {
|
||||||
describe('url', () => {
|
describe('url', () => {
|
||||||
test('isURL() - should return true for localhost', () => {
|
test('isURL() - should return true for localhost', () => {
|
||||||
expect(isURL('http://localhost:8080/bootstrap/-/bootstrap-4.3.1.tgz')).toBeTruthy();
|
expect(isURL('http://localhost:8080/bootstrap/-/bootstrap-4.3.1.tgz')).toBeTruthy();
|
||||||
@ -21,7 +22,15 @@ describe('url', () => {
|
|||||||
expect(getRegistryURL()).toBe('http://localhost/-/web/detail');
|
expect(getRegistryURL()).toBe('http://localhost/-/web/detail');
|
||||||
history.pushState({}, 'page title', '/');
|
history.pushState({}, 'page title', '/');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getRegistryURL() - should not add slash if location is not a sub directory', () => {
|
test('getRegistryURL() - should not add slash if location is not a sub directory', () => {
|
||||||
expect(getRegistryURL()).toBe('http://localhost');
|
expect(getRegistryURL()).toBe('http://localhost');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('extractFileName', () => {
|
||||||
|
test('should return the file name', () => {
|
||||||
|
expect(extractFileName('http://localhost:4872/juan_test_webpack1/-/test-10.0.0.tgz')).toBe('test-10.0.0.tgz');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user