1
0
mirror of https://github.com/koloml/philomena-tagging-assistant.git synced 2026-09-23 04:19:39 +00:00

Covering cacheable preferences into tests

This commit is contained in:
2026-06-20 20:59:49 +04:00
parent b905ed668c
commit 74554bc9f6
3 changed files with 177 additions and 3 deletions

View File

@@ -70,7 +70,7 @@ export default class ConfigurationController {
return;
}
callback(changes[this.#configurationName].newValue);
callback(changes[this.#configurationName].newValue as Record<string, any>);
}
this.#storage.subscribe(subscriber);

View File

@@ -95,10 +95,11 @@ export default abstract class CacheablePreferences<Fields> {
/**
* @param settingsNamespace Name of the field inside the extension storage where these preferences stored.
* @param [controller] Configuration controller. If not provided, default controller will be used.
* @protected
*/
protected constructor(settingsNamespace: string) {
this.#controller = new ConfigurationController(settingsNamespace);
protected constructor(settingsNamespace: string, controller: ConfigurationController = new ConfigurationController(settingsNamespace)) {
this.#controller = controller;
this.#disposables.push(
this.#controller.subscribeToChanges(settings => {