Added getMemoryStorage as entry point

This commit is contained in:
Michaël Lemaire 2019-11-14 18:15:03 +01:00
parent b490f08862
commit ec543ddc3f
2 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import { getLocalStorage } from ".";
import { getLocalStorage, getMemoryStorage } from ".";
import { MemoryStorage, ScopedStorage } from "./basic";
import { BrowserLocalStorage } from "./browser";
import { NodeDirectoryStorage } from "./node";
@ -41,3 +41,10 @@ describe(getLocalStorage, () => {
expect(mockWarn).toHaveBeenCalledWith("No persistent storage available, using in-memory volatile storage");
});
});
describe(getMemoryStorage, () => {
it("returns a memory storage", () => {
const storage = getMemoryStorage();
expect(storage).toBeInstanceOf(MemoryStorage);
});
});

View File

@ -17,3 +17,10 @@ export function getLocalStorage(appname: string): KeyValueStorage {
}
}
}
/**
* Récupère un stockage "mémoire"
*/
export function getMemoryStorage(): KeyValueStorage {
return new MemoryStorage();
}