Skip to content

Commit

Permalink
test(util): add additional test coverage
Browse files Browse the repository at this point in the history
closes #14
  • Loading branch information
ryansonshine committed May 16, 2021
1 parent 4201dbb commit 86a28fc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/util/npmrc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
});
});
});
17 changes: 17 additions & 0 deletions test/util/string.spec.ts
Original file line number Diff line number Diff line change
@@ -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');
});
});
});

0 comments on commit 86a28fc

Please sign in to comment.