1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/test/fixtures/fake-setting-store.ts
Ivar Conradi Østhus 4fb1bcb524
feat: Disable password based login (#1046)
This commit will introduce a new setting used to disbaled
simple password based authention.

The setting itself is an enterprise setting.
2021-10-29 10:25:42 +02:00

42 lines
1.1 KiB
TypeScript

import { ISettingStore } from '../../lib/types/stores/settings-store';
export default class FakeSettingStore implements ISettingStore {
settings: Map<string, any> = new Map();
async delete(key: string): Promise<void> {
this.settings.delete(key);
}
async deleteAll(): Promise<void> {
this.settings = new Map();
}
destroy(): void {}
async exists(key: string): Promise<boolean> {
return this.settings.has(key);
}
async get(key: string): Promise<any> {
const setting = this.settings.get(key);
if (setting) {
return setting;
}
return undefined;
}
async getAll(): Promise<any[]> {
return Array.from(this.settings.values());
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
async insert(name: string, content: any): Promise<void> {
this.settings.set(name, content);
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
async updateRow(name: string, content: any): Promise<void> {
this.settings.set(name, content);
}
}