From ba9ae78d7d90894a746ff4552e2257b64c501f81 Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 3 Jul 2023 15:02:15 -0500 Subject: [PATCH] Update and add tests for configurable scheme --- test/browser.test.js | 58 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/test/browser.test.js b/test/browser.test.js index a6c25ef..f8130c2 100644 --- a/test/browser.test.js +++ b/test/browser.test.js @@ -66,38 +66,78 @@ describe('browser', function () { }) }) describe('generateProfileURL()', function () { - it('should handle a WKD URL', async function () { + it('should handle a https WKD URL', async function () { const local = await utils.generateProfileURL({ source: 'wkd', input: 'test@doip.rocks', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/test@doip.rocks') }) - it('should handle a HKP+email URL', async function () { + it('should handle a http WKD URL', async function () { + const local = await utils.generateProfileURL({ + source: 'wkd', + input: 'test@doip.rocks', + hostname: 'keyoxide.instance', + scheme: 'http' + }) + local.should.equal('http://keyoxide.instance/test@doip.rocks') + }) + it('should handle a https HKP+email URL', async function () { const local = await utils.generateProfileURL({ source: 'hkp', input: 'test@doip.rocks', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/hkp/test@doip.rocks') }) - it('should handle a HKP+fingerprint URL', async function () { + it('should handle a http HKP+email URL', async function () { + const local = await utils.generateProfileURL({ + source: 'hkp', + input: 'test@doip.rocks', + hostname: 'keyoxide.instance', + scheme: 'http' + }) + local.should.equal('http://keyoxide.instance/hkp/test@doip.rocks') + }) + it('should handle a https HKP+fingerprint URL', async function () { const local = await utils.generateProfileURL({ source: 'hkp', input: '3637202523E7C1309AB79E99EF2DC5827B445F4B', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/3637202523E7C1309AB79E99EF2DC5827B445F4B') }) - it('should handle a keybase URL', async function () { + it('should handle a http HKP+fingerprint URL', async function () { + const local = await utils.generateProfileURL({ + source: 'hkp', + input: '3637202523E7C1309AB79E99EF2DC5827B445F4B', + hostname: 'keyoxide.instance', + scheme: 'http' + }) + local.should.equal('http://keyoxide.instance/3637202523E7C1309AB79E99EF2DC5827B445F4B') + }) + it('should handle a https keybase URL', async function () { const local = await utils.generateProfileURL({ source: 'keybase', input: 'https://keybase.io/doip/pgp_keys.asc?fingerprint=3637202523E7C1309AB79E99EF2DC5827B445F4B', - hostname: 'keyoxide.instance' + hostname: 'keyoxide.instance', + scheme: 'https' }) local.should.equal('https://keyoxide.instance/keybase/doip/3637202523E7C1309AB79E99EF2DC5827B445F4B') }) + it('should handle a http keybase URL', async function () { + const local = await utils.generateProfileURL({ + source: 'keybase', + input: 'https://keybase.io/doip/pgp_keys.asc?fingerprint=3637202523E7C1309AB79E99EF2DC5827B445F4B', + hostname: 'keyoxide.instance', + scheme: 'http' + }) + local.should.equal('http://keyoxide.instance/keybase/doip/3637202523E7C1309AB79E99EF2DC5827B445F4B') + }) }) }) -}) \ No newline at end of file +})