mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Only accept NamedNodes as predicates for metadata
* refactor: move toCachedNamedNode (private) * chore: only NamedNodes predicates in removes * feat: enforce NamedNode predicates in most cases * feat: getAll only accepts NamedNodes * feat: toCachedNamedNode only accepts string arg * tests: use NamedNodes for getAll calls * test: remove unnecessary string check for coverage * tests: fix NamedNodes in new tests after rebase * feat: metadatawriters store NamedNodes * refactor: toCachedNamedNode as utility function * fix: double write of linkRelMap * test: use the CONTENT_TYPE constant
This commit is contained in:
@@ -42,7 +42,7 @@ describe('A PatchOperationHandler', (): void => {
|
||||
expect(store.modifyResource).toHaveBeenCalledTimes(1);
|
||||
expect(store.modifyResource).toHaveBeenLastCalledWith(operation.target, body, conditions);
|
||||
expect(result.statusCode).toBe(201);
|
||||
expect(result.metadata?.get(SOLID_HTTP.location)?.value).toBe(operation.target.path);
|
||||
expect(result.metadata?.get(SOLID_HTTP.terms.location)?.value).toBe(operation.target.path);
|
||||
expect(result.data).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('A PostOperationHandler', (): void => {
|
||||
const result = await handler.handle({ operation });
|
||||
expect(result.statusCode).toBe(201);
|
||||
expect(result.metadata).toBeInstanceOf(RepresentationMetadata);
|
||||
expect(result.metadata?.get(SOLID_HTTP.location)?.value).toBe('newPath');
|
||||
expect(result.metadata?.get(SOLID_HTTP.terms.location)?.value).toBe('newPath');
|
||||
expect(result.data).toBeUndefined();
|
||||
expect(store.addResource).toHaveBeenCalledTimes(1);
|
||||
expect(store.addResource).toHaveBeenLastCalledWith(operation.target, body, conditions);
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('A PutOperationHandler', (): void => {
|
||||
expect(store.setRepresentation).toHaveBeenCalledTimes(1);
|
||||
expect(store.setRepresentation).toHaveBeenLastCalledWith(operation.target, body, conditions);
|
||||
expect(result.statusCode).toBe(201);
|
||||
expect(result.metadata?.get(SOLID_HTTP.location)?.value).toBe(operation.target.path);
|
||||
expect(result.metadata?.get(SOLID_HTTP.terms.location)?.value).toBe(operation.target.path);
|
||||
expect(result.data).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user