mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00

This replaces the recursive backend calls to find the storage by a new class that is aware what the storage URLs look like.
16 lines
711 B
TypeScript
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/' });
|
|
});
|
|
});
|