[MM-39885] Migrate unit tests to Jest, fleshed out tests for common/util, a bunch of cleanup (#1852)

* [MM-39885] Migrate unit tests to Jest, fleshed out tests for common/util/url

* Typo fix

* Oops

* I found more tests!

* Fixed a bug

* Oops again

* Tests for common/utils/util

* A bunch of cleanup

* Oops
This commit is contained in:
Devin Binnie
2021-11-08 10:04:47 -05:00
committed by GitHub
parent fbb3c9c705
commit 38270fcfe8
15 changed files with 7224 additions and 348 deletions

View File

@@ -13,20 +13,4 @@ export class MattermostServer {
throw new Error('Invalid url for creating a server');
}
}
getServerInfo = () => {
// does the server have a subpath?
const normalizedPath = this.url.pathname.toLowerCase();
const subpath = normalizedPath.endsWith('/') ? normalizedPath : `${normalizedPath}/`;
return {origin: this.url.origin, subpath, url: this.url.toString()};
}
sameOrigin = (otherURL: string) => {
const parsedUrl = urlUtils.parseURL(otherURL);
return parsedUrl && this.url.origin === parsedUrl.origin;
}
equals = (otherServer: MattermostServer) => {
return (this.name === otherServer.name) && (this.url.toString() === otherServer.url.toString());
}
}