summaryrefslogtreecommitdiff
path: root/packages/backend/test
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2025-04-21 14:58:22 +0100
committerdakkar <dakkar@thenautilus.net>2025-04-21 16:44:13 +0100
commitfda71c414727b98ed52eb6a9195b3bbdcfda9054 (patch)
tree949ec13907415d4abf841bc662d2537317bfd5f2 /packages/backend/test
parentcheck signatures with and without query - fix #1036 (diff)
downloadsharkey-fda71c414727b98ed52eb6a9195b3bbdcfda9054.tar.gz
sharkey-fda71c414727b98ed52eb6a9195b3bbdcfda9054.tar.bz2
sharkey-fda71c414727b98ed52eb6a9195b3bbdcfda9054.zip
make `toPuny` work better in testing
Diffstat (limited to 'packages/backend/test')
-rw-r--r--packages/backend/test/unit/UtilityService.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/backend/test/unit/UtilityService.ts b/packages/backend/test/unit/UtilityService.ts
index d86e794f2f..cb010ff1f9 100644
--- a/packages/backend/test/unit/UtilityService.ts
+++ b/packages/backend/test/unit/UtilityService.ts
@@ -22,6 +22,12 @@ describe('UtilityService', () => {
test('japanese', () => {
assert.equal(utilityService.punyHost('http://www.新聞.com'), 'www.xn--efvv70d.com');
});
+ test('simple, with port', () => {
+ assert.equal(utilityService.punyHost('http://www.foo.com:3000'), 'www.foo.com:3000');
+ });
+ test('japanese, with port', () => {
+ assert.equal(utilityService.punyHost('http://www.新聞.com:3000'), 'www.xn--efvv70d.com:3000');
+ });
});
describe('punyHostPSLDomain', () => {
@@ -31,6 +37,12 @@ describe('UtilityService', () => {
test('japanese', () => {
assert.equal(utilityService.punyHostPSLDomain('http://www.新聞.com'), 'xn--efvv70d.com');
});
+ test('simple, with port', () => {
+ assert.equal(utilityService.punyHostPSLDomain('http://www.foo.com:3000'), 'foo.com:3000');
+ });
+ test('japanese, with port', () => {
+ assert.equal(utilityService.punyHostPSLDomain('http://www.新聞.com:3000'), 'xn--efvv70d.com:3000');
+ });
test('lower', () => {
assert.equal(utilityService.punyHostPSLDomain('http://foo.github.io'), 'foo.github.io');
assert.equal(utilityService.punyHostPSLDomain('http://foo.bar.github.io'), 'bar.github.io');
@@ -40,4 +52,13 @@ describe('UtilityService', () => {
assert.equal(utilityService.punyHostPSLDomain('http://foo.bar.masto.host'), 'bar.masto.host');
});
});
+
+ describe('toPuny', () => {
+ test('without port ', () => {
+ assert.equal(utilityService.toPuny('www.foo.com'), 'www.foo.com');
+ });
+ test('with port ', () => {
+ assert.equal(utilityService.toPuny('www.foo.com:3000'), 'www.foo.com:3000');
+ });
+ });
});