mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: metadata file error in FileResourceStore
* Fix: metadata file error in FileResourceStore * fix: ensure full test coverage * add stream piping function in util * Fix typing in util function * Add requested changes * add suggested changes * add suggested change Co-authored-by: freyavs <freyavanspeybroeck@outlook.com>
This commit is contained in:
committed by
GitHub
parent
7fae3203d5
commit
c808dfeff0
@@ -205,7 +205,7 @@ describe('A FileResourceStore', (): void => {
|
||||
stats.isFile = jest.fn((): any => true);
|
||||
(fsPromises.lstat as jest.Mock).mockReturnValueOnce(stats);
|
||||
(fs.createReadStream as jest.Mock).mockReturnValueOnce(streamifyArray([ rawData ]));
|
||||
(fs.createReadStream as jest.Mock).mockImplementationOnce((): any => new Error('Metadata file does not exist.'));
|
||||
(fs.createReadStream as jest.Mock).mockReturnValueOnce(streamifyArray([]));
|
||||
|
||||
// Tests
|
||||
await store.setRepresentation({ path: `${base}file.txt` }, representation);
|
||||
@@ -488,7 +488,8 @@ describe('A FileResourceStore', (): void => {
|
||||
stats.isFile = jest.fn((): any => true);
|
||||
(fsPromises.lstat as jest.Mock).mockReturnValueOnce(stats);
|
||||
(fs.createReadStream as jest.Mock).mockReturnValueOnce(streamifyArray([ rawData ]));
|
||||
(fs.createReadStream as jest.Mock).mockImplementationOnce((): any => new Error('Metadata file does not exist.'));
|
||||
(fs.createReadStream as jest.Mock).mockReturnValueOnce(new Readable()
|
||||
.destroy(new Error('Metadata file does not exist.')));
|
||||
|
||||
const result = await store.getRepresentation({ path: `${base}.htaccess` });
|
||||
expect(result).toEqual({
|
||||
|
||||
Reference in New Issue
Block a user