1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-25 20:53:28 +00:00

Added testcases for urls containing umlauts

This commit is contained in:
Daniel James Smith
2021-11-11 18:11:34 +01:00
parent cf302d780c
commit 0eef358267

View File

@@ -54,6 +54,16 @@ describe('Utils Service', () => {
expect(Utils.getDomain('https://my_vault.bitwarden.com/')).toBe('bitwarden.com');
});
it('should support urls containing umlauts', () => {
expect(Utils.getDomain('bütwarden.com')).toBe('bütwarden.com');
expect(Utils.getDomain('http://bütwarden.com')).toBe('bütwarden.com');
expect(Utils.getDomain('https://bütwarden.com')).toBe('bütwarden.com');
expect(Utils.getDomain('subdomain.bütwarden.com')).toBe('bütwarden.com');
expect(Utils.getDomain('http://subdomain.bütwarden.com')).toBe('bütwarden.com');
expect(Utils.getDomain('https://subdomain.bütwarden.com')).toBe('bütwarden.com');
});
it('should support localhost', () => {
expect(Utils.getDomain('localhost')).toBe('localhost');
expect(Utils.getDomain('http://localhost')).toBe('localhost');
@@ -126,6 +136,16 @@ describe('Utils Service', () => {
expect(Utils.getHostname('https://my_vault.bitwarden.com/')).toBe('my_vault.bitwarden.com');
});
it('should support urls containing umlauts', () => {
expect(Utils.getHostname('bütwarden.com')).toBe('bütwarden.com');
expect(Utils.getHostname('http://bütwarden.com')).toBe('bütwarden.com');
expect(Utils.getHostname('https://bütwarden.com')).toBe('bütwarden.com');
expect(Utils.getHostname('subdomain.bütwarden.com')).toBe('subdomain.bütwarden.com');
expect(Utils.getHostname('http://subdomain.bütwarden.com')).toBe('subdomain.bütwarden.com');
expect(Utils.getHostname('https://subdomain.bütwarden.com')).toBe('subdomain.bütwarden.com');
});
it('should support localhost', () => {
expect(Utils.getHostname('localhost')).toBe('localhost');
expect(Utils.getHostname('http://localhost')).toBe('localhost');