Implement a lot of technical requirements for behavioural unit tests

Note: the crux of this was to make routing env-agnostic, and not based on URLs as magic strings, but instead something type-enforced.

Note: extension-based routes comply to same exact interface by "late-registering" their routes when installed. Routes are just injectables.

Note: another chunk of global shared state is no more.

Note: a lot of explicit side effects have been cornered to injectables.

Note: a lot of stuff has become reactive as part if this.

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne SavolainenandMikko Aspiala committed 2022-03-31 15:13:26 +03:00
1 parent 086604630a
commit 5c8ca2c038
523 files changed
+11727 -5541

No files matched your search

+11
View File
@@ -32,6 +32,10 @@ export class LensExtension {
readonly manifestPath: string;
readonly isBundled: boolean;
get sanitizedExtensionId() {
return sanitizeExtensionName(this.name);
}
protocolHandlers: ProtocolHandlerRegistration[] = [];
@observable private _isEnabled = false;
@@ -90,6 +94,7 @@ export class LensExtension {
this[Disposers].push(...await register(this));
logger.info(`[EXTENSION]: enabled ${this.name}@${this.version}`);
} catch (error) {
logger.error(`[EXTENSION]: failed to activate ${this.name}@${this.version}: ${error}`);
}
@@ -129,6 +134,12 @@ export function sanitizeExtensionName(name: string) {
return name.replace("@", "").replace("/", "--");
}
export const getSanitizedPath = (...parts: string[]) => parts
.filter(Boolean)
.join("/")
.replace(/\/+/g, "/")
.replace(/\/$/, ""); // normalize multi-slashes (e.g. coming from page.id)
export function extensionDisplayName(name: string, version: string) {
return `${name}@${version}`;
}