Repository: solid/community-server
Pull request #81 (2020-08-30 23:19:52)

Update dependency @types/jest to v26
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/jest](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^25.2.1` -> `^26.0.0`](https://renovatebot.com/diffs/npm/@types%2fjest/25.2.3/26.0.10) |

---

### Renovate configuration

:date: **Schedule**: "before 7am every weekday" in timezone Europe/Brussels.

:vertical_traffic_light: **Automerge**: Enabled.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/solid/community-server).


Patch:
diff --git a/package-lock.json b/package-lock.json
index f02841929..c9b5c0186 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -867,9 +867,9 @@
       }
     },
     "@types/jest": {
-      "version": "25.2.3",
-      "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.2.3.tgz",
-      "integrity": "sha512-JXc1nK/tXHiDhV55dvfzqtmP4S3sy3T3ouV2tkViZgxY/zeUkcpQcQPGRlgF4KmWzWW5oiWYSZwtCB+2RsE4Fw==",
+      "version": "26.0.10",
+      "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.10.tgz",
+      "integrity": "sha512-i2m0oyh8w/Lum7wWK/YOZJakYF8Mx08UaKA1CtbmFeDquVhAEdA7znacsVSf2hJ1OQ/OfVMGN90pw/AtzF8s/Q==",
       "dev": true,
       "requires": {
         "jest-diff": "^25.2.1",
diff --git a/package.json b/package.json
index a03f235ae..38c7b4bba 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,5 @@
 {
   "name": "@solid/community-server",
-  "private": true,
   "version": "0.0.1",
   "main": "index.js",
   "license": "MIT",
@@ -50,7 +49,7 @@
   },
   "devDependencies": {
     "@types/arrayify-stream": "^1.0.0",
-    "@types/jest": "^25.2.1",
+    "@types/jest": "^26.0.0",
     "@types/streamify-array": "^1.0.0",
     "@types/supertest": "^2.0.10",
     "@typescript-eslint/eslint-plugin": "^2.33.0",
diff --git a/src/init/RuntimeConfig.ts b/src/init/RuntimeConfig.ts
index d0d4d572c..517a0f36c 100644
--- a/src/init/RuntimeConfig.ts
+++ b/src/init/RuntimeConfig.ts
@@ -1,3 +1,5 @@
+import { ensureTrailingSlash } from '../util/Util';
+
 /**
  * This class holds all configuration options that can be defined by the user via the command line.
  *
@@ -14,10 +16,13 @@ export class RuntimeConfig implements RuntimeConfigData {
 
   public reset(data: RuntimeConfigData): void {
     this.pport = data.port ?? 3000;
-    this.pbase = data.base ?? `http://localhost:${this.port}/`;
+    this.pbase = ensureTrailingSlash(data.base ?? `http://localhost:${this.port}/`);
     this.prootFilepath = data.rootFilepath ?? process.cwd();
   }
 
+  /**
+   * The returned URL is ensured to have a trailing slash.
+   */
   public get base(): string {
     return this.pbase;
   }
diff --git a/src/storage/UrlContainerManager.ts b/src/storage/UrlContainerManager.ts
index c6e491c1c..a364b8004 100644
--- a/src/storage/UrlContainerManager.ts
+++ b/src/storage/UrlContainerManager.ts
@@ -15,7 +15,7 @@ export class UrlContainerManager implements ContainerManager {
 
   public async getContainer(id: ResourceIdentifier): Promise<ResourceIdentifier> {
     const path = this.canonicalUrl(id.path);
-    if (this.canonicalUrl(this.runtimeConfig.base) === path) {
+    if (this.runtimeConfig.base === path) {
       throw new Error('Root does not have a container.');
     }
 
@@ -30,6 +30,6 @@ export class UrlContainerManager implements ContainerManager {
   }
 
   private canonicalUrl(path: string): string {
-    return ensureTrailingSlash(new URL(path).toString());
+    return ensureTrailingSlash(path.toString());
   }
 }


Test patch:
diff --git a/test/unit/init/RuntimeConfig.test.ts b/test/unit/init/RuntimeConfig.test.ts
index 36a609674..23a65ab44 100644
--- a/test/unit/init/RuntimeConfig.test.ts
+++ b/test/unit/init/RuntimeConfig.test.ts
@@ -40,4 +40,9 @@ describe('RuntimeConfig', (): void => {
     expect(config.port).toEqual(1234);
     expect(config.base).toEqual('http://example.org/');
   });
+
+  it('ensures trailing slash in base.', async(): Promise<void> => {
+    const config = new RuntimeConfig({ base: 'http://example.org' });
+    expect(config.base).toEqual('http://example.org/');
+  });
 });