mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Combine pod creation with IDP registration
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import type { ResourceIdentifier } from '../../../src/ldp/representation/ResourceIdentifier';
|
||||
import { ConfigPodManager } from '../../../src/pods/ConfigPodManager';
|
||||
import type { IdentifierGenerator } from '../../../src/pods/generate/IdentifierGenerator';
|
||||
import type { PodGenerator } from '../../../src/pods/generate/PodGenerator';
|
||||
import type { Resource, ResourcesGenerator } from '../../../src/pods/generate/ResourcesGenerator';
|
||||
import type { PodSettings } from '../../../src/pods/settings/PodSettings';
|
||||
@@ -10,9 +9,6 @@ import type { ResourceStore } from '../../../src/storage/ResourceStore';
|
||||
describe('A ConfigPodManager', (): void => {
|
||||
let settings: PodSettings;
|
||||
const base = 'http://test.com/';
|
||||
const idGenerator: IdentifierGenerator = {
|
||||
generate: (slug: string): ResourceIdentifier => ({ path: `${base}${slug}/` }),
|
||||
};
|
||||
let store: ResourceStore;
|
||||
let podGenerator: PodGenerator;
|
||||
let routingStorage: KeyValueStorage<string, ResourceStore>;
|
||||
@@ -50,12 +46,12 @@ describe('A ConfigPodManager', (): void => {
|
||||
set: async(key: ResourceIdentifier, value: ResourceStore): Promise<any> => map.set(key, value),
|
||||
} as any;
|
||||
|
||||
manager = new ConfigPodManager(idGenerator, podGenerator, resourcesGenerator, routingStorage);
|
||||
manager = new ConfigPodManager(podGenerator, resourcesGenerator, routingStorage);
|
||||
});
|
||||
|
||||
it('creates a pod and returns the newly generated identifier.', async(): Promise<void> => {
|
||||
const identifier = { path: `${base}alice/` };
|
||||
await expect(manager.createPod(settings)).resolves.toEqual(identifier);
|
||||
await expect(manager.createPod(identifier, settings)).resolves.toBeUndefined();
|
||||
expect(podGenerator.generate).toHaveBeenCalledTimes(1);
|
||||
expect(podGenerator.generate).toHaveBeenLastCalledWith(identifier, settings);
|
||||
expect(resourcesGenerator.generate).toHaveBeenCalledTimes(1);
|
||||
|
||||
Reference in New Issue
Block a user