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

* bug: correctly handle slug in POST request * bug: disallow slashes in slug + modified tests * fix: fixed tests to work with PUT instead of POST+slug * fix: fixed tests failing in ci * fix: adapted to reviews * fix: adapted to review
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import type { HttpHandler, Initializer, ResourceStore } from '../../src/';
|
|
import { describeIf, ResourceHelper } from '../util/TestHelpers';
|
|
import { BASE, instantiateFromConfig } from './Config';
|
|
|
|
describeIf('docker', 'A server with a SPARQL endpoint as storage', (): void => {
|
|
let handler: HttpHandler;
|
|
let resourceHelper: ResourceHelper;
|
|
|
|
beforeAll(async(): Promise<void> => {
|
|
// Set up the internal store
|
|
const variables: Record<string, any> = {
|
|
'urn:solid-server:default:variable:baseUrl': BASE,
|
|
'urn:solid-server:default:variable:sparqlEndpoint': 'http://localhost:4000/sparql',
|
|
};
|
|
const internalStore = await instantiateFromConfig(
|
|
'urn:solid-server:default:SparqlResourceStore',
|
|
'ldp-with-auth.json',
|
|
variables,
|
|
) as ResourceStore;
|
|
variables['urn:solid-server:default:variable:store'] = internalStore;
|
|
|
|
// Create and initialize the HTTP handler and related components
|
|
let initializer: Initializer;
|
|
const instances = await instantiateFromConfig(
|
|
'urn:solid-server:test:Instances',
|
|
'ldp-with-auth.json',
|
|
variables,
|
|
) as Record<string, any>;
|
|
({ handler, initializer } = instances);
|
|
await initializer.handleSafe();
|
|
|
|
// Create test helpers for manipulating the components
|
|
resourceHelper = new ResourceHelper(handler, BASE);
|
|
});
|
|
|
|
it('can add a Turtle file to the store.', async():
|
|
Promise<void> => {
|
|
// PUT
|
|
const response = await resourceHelper.createResource('../assets/person.ttl', 'person', 'text/turtle');
|
|
expect(response).toBeTruthy();
|
|
});
|
|
});
|