Skip to content

Commit

Permalink
test: change to container paths to end in / on POST only
Browse files Browse the repository at this point in the history
  • Loading branch information
Falx committed Feb 21, 2022
1 parent 472caea commit 07b8e3c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions test/integration/LdpHandlerWithoutAuth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,14 @@ describe.each(stores)('An LDP handler allowing all requests %s', (name, { storeC
});

it('can create a container with a diamond identifier in the data.', async(): Promise<void> => {
const slug = 'my-container';
const slug = 'my-container/';

const body = '<> <http://www.w3.org/2000/01/rdf-schema#label> "My Container" .';
let response = await postResource(baseUrl, { isContainer: true, contentType: 'text/turtle', slug, body });
expect(response.headers.get('location')).toBe(`${baseUrl}${slug}/`);
expect(response.headers.get('location')).toBe(`${baseUrl}${slug}`);

// GET
const containerUrl = `${baseUrl}${slug}/`;
const containerUrl = `${baseUrl}${slug}`;
response = await getResource(containerUrl);

await expectQuads(response, [
Expand Down
3 changes: 0 additions & 3 deletions test/integration/ServerFetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ describe('A Solid server', (): void => {
method: 'PUT',
headers: {
'content-type': 'text/turtle',
'link': `<${LDP.Container}>; rel="type"`,
},
body: '<a:b> <a:b> <a:b>.',
});
Expand Down Expand Up @@ -141,7 +140,6 @@ describe('A Solid server', (): void => {
method: 'PUT',
headers: {
'content-type': 'text/turtle',
'link': `<${LDP.Container}>; rel="type"`,
},
body: '<a:b> <a:b> <a:b>.',
});
Expand Down Expand Up @@ -187,7 +185,6 @@ describe('A Solid server', (): void => {
method: 'PUT',
headers: {
'content-type': 'text/turtle',
'link': `<${LDP.Container}>; rel="type"`,
},
body: '<a:b> <a:b> <a:b>.',
});
Expand Down
1 change: 1 addition & 0 deletions test/unit/storage/DataAccessorBasedStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ describe('A DataAccessorBasedStore', (): void => {
it('will error if the ending slash does not match its resource type.', async(): Promise<void> => {
const resourceID = { path: `${root}resource` };
representation.metadata.add(RDF.type, LDP.terms.Container);
representation.metadata.add(SOLID_HTTP.slug, `${root}resource/`);
await expect(store.setRepresentation(resourceID, representation)).rejects.toThrow(
new BadRequestHttpError('Containers should have a `/` at the end of their path, resources should not.'),
);
Expand Down

0 comments on commit 07b8e3c

Please sign in to comment.