CommunitySolidServer/test/unit/server/description/PodStorageLocationStrategy.test.ts
Joachim Van Herwegen 23db528472 fix: Replace inefficient storage detection
This replaces the recursive backend calls to find the storage
by a new class that is aware what the storage URLs look like.
2023-04-19 09:47:47 +02:00

16 lines
711 B
TypeScript

import type { IdentifierGenerator } from '../../../../src/pods/generate/IdentifierGenerator';
import { PodStorageLocationStrategy } from '../../../../src/server/description/PodStorageLocationStrategy';
describe('A PodStorageLocationStrategy', (): void => {
const generator: IdentifierGenerator = {
generate: jest.fn(),
extractPod: jest.fn().mockReturnValue({ path: 'http://example.com/' }),
};
const strategy = new PodStorageLocationStrategy(generator);
it('returns the result of the identifier generator.', async(): Promise<void> => {
await expect(strategy.getStorageIdentifier({ path: 'http://example.com/whatever' }))
.resolves.toEqual({ path: 'http://example.com/' });
});
});