1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-20 10:13:43 +00:00

Add tests for url with an underscore in the subdomain

This commit is contained in:
Daniel James Smith
2021-11-11 16:42:32 +01:00
parent 765b1f4786
commit 96f925ac07

View File

@@ -48,6 +48,12 @@ describe('Utils Service', () => {
expect(Utils.getDomain('https://bitwarden.unknown')).toBe('bitwarden.unknown');
});
it('should handle valid urls with an underscore in subdomain', () => {
expect(Utils.getDomain('my_vault.bitwarden.com/')).toBe('bitwarden.com');
expect(Utils.getDomain('http://my_vault.bitwarden.com/')).toBe('bitwarden.com');
expect(Utils.getDomain('https://my_vault.bitwarden.com/')).toBe('bitwarden.com');
});
it('should support localhost', () => {
expect(Utils.getDomain('localhost')).toBe('localhost');
expect(Utils.getDomain('http://localhost')).toBe('localhost');
@@ -110,6 +116,10 @@ describe('Utils Service', () => {
expect(Utils.getHostname('https://bitwarden.unknown')).toBe('bitwarden.unknown');
});
it('should handle valid urls with an underscore in subdomain', () => {
expect(Utils.getHostname('my_vault.bitwarden.com/')).toBe('my_vault.bitwarden.com');
expect(Utils.getHostname('http://my_vault.bitwarden.com/')).toBe('my_vault.bitwarden.com');
expect(Utils.getHostname('https://my_vault.bitwarden.com/')).toBe('my_vault.bitwarden.com');
});
it('should support localhost', () => {