From 0eef358267a3f641feaebf2054ed235d7d70383e Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Thu, 11 Nov 2021 18:11:34 +0100 Subject: [PATCH] Added testcases for urls containing umlauts --- spec/common/misc/utils.spec.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/common/misc/utils.spec.ts b/spec/common/misc/utils.spec.ts index 00c0f681..a3bed402 100644 --- a/spec/common/misc/utils.spec.ts +++ b/spec/common/misc/utils.spec.ts @@ -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');