1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 05:43:41 +00:00
Files
browser/libs/storage-core/src/storage-service.provider.spec.ts
Addison Beck 95841eb078 refactor(storage-core): move storage files out of @bitwarden/common (#15076)
* refactor(platform): generate @bitwarden/storage-core boilerplate

* refactor(storage-core): move storage files out of @bitwarden/common

* chore(naming): rename AbstractStorageService to StorageService
2025-06-23 16:00:54 -04:00

28 lines
1.0 KiB
TypeScript

import { mock } from "jest-mock-extended";
import { StorageServiceProvider } from "./storage-service.provider";
import { StorageService, ObservableStorageService } from "./storage.service";
describe("StorageServiceProvider", () => {
const mockDiskStorage = mock<StorageService & ObservableStorageService>();
const mockMemoryStorage = mock<StorageService & ObservableStorageService>();
const sut = new StorageServiceProvider(mockDiskStorage, mockMemoryStorage);
describe("get", () => {
it("gets disk service when default location is disk", () => {
const [computedLocation, computedService] = sut.get("disk", {});
expect(computedLocation).toBe("disk");
expect(computedService).toStrictEqual(mockDiskStorage);
});
it("gets memory service when default location is memory", () => {
const [computedLocation, computedService] = sut.get("memory", {});
expect(computedLocation).toBe("memory");
expect(computedService).toStrictEqual(mockMemoryStorage);
});
});
});