fix: Prevent data from being drained when read

Comments were also added and URI generation takes slash into account
This commit is contained in:
Joachim Van Herwegen
2020-07-10 14:21:54 +02:00
parent cff9790b6e
commit c53ab5ed9b
3 changed files with 96 additions and 3 deletions

View File

@@ -59,6 +59,13 @@ describe('A SimpleResourceStore', (): void => {
await expect(arrayifyStream(result.data)).resolves.toEqualRdfQuadArray([ quad ]);
});
it('can add resources to previously added resources.', async(): Promise<void> => {
const identifier = await store.addResource({ path: base }, representation);
representation.data = streamifyArray([ quad ]);
const childIdentifier = await store.addResource(identifier, representation);
expect(childIdentifier.path).toContain(identifier.path);
});
it('can read binary data.', async(): Promise<void> => {
const identifier = await store.addResource({ path: base }, representation);
expect(identifier.path.startsWith(base)).toBeTruthy();