diff --git a/test/util/npmrc.spec.ts b/test/util/npmrc.spec.ts index 7b93321..77d2a7d 100644 --- a/test/util/npmrc.spec.ts +++ b/test/util/npmrc.spec.ts @@ -27,5 +27,11 @@ describe('npmrc', () => { expect(registry).toMatch(RE_URL); expect(otherRegistries).toHaveLength(0); }); + + it('should not throw when an undefined value is passed in', () => { + const registry = getRegistryFromNpmrc(); + + expect(registry).toEqual([]); + }); }); }); diff --git a/test/util/string.spec.ts b/test/util/string.spec.ts new file mode 100644 index 0000000..0cf4be3 --- /dev/null +++ b/test/util/string.spec.ts @@ -0,0 +1,17 @@ +import { removeTrailingSlash } from '../../src/util/string'; + +describe('string', () => { + describe('removeTrailingSlash', () => { + it('should remove trailing slashes with expected inputs', () => { + expect(removeTrailingSlash('https://google.com/')).toEqual( + 'https://google.com' + ); + + expect(removeTrailingSlash(0)).toEqual(''); + + expect( + removeTrailingSlash('http://local/url/with/trailing/slash/') + ).toEqual('http://local/url/with/trailing/slash'); + }); + }); +});