Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VFS Archive support #190

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions __tests__/adapters/vfs/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,44 @@ describe('System VFS Adapter', () => {
expect(open).toBeCalled();
});
});

test('#archive - compress file', () => {
return expect(
adapter.archive(['null:/filename'], {
action: 'compress',
})
).resolves.toEqual({});
});

test('#archive - decompress file', () => {
return expect(
adapter.archive(['null:/filename'], {
action: 'extract',
})
).resolves.toEqual({});
});

test('#archive - compress directory', () => {
return expect(
adapter.archive(['null:/directory'], {
action: 'compress',
})
).resolves.toEqual({});
});

test('#archive - decompress directory', () => {
return expect(
adapter.archive(['null:/directory'], {
action: 'extract',
})
).resolves.toEqual({});
});

test('#archive - decompress multiple selections', () => {
return expect(
adapter.archive(['null:/filename', 'null:/directory'], {
action: 'extract',
})
).resolves.toEqual({});
});
});
22 changes: 22 additions & 0 deletions __tests__/vfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,28 @@ describe('VFS', () => {
.toBe(undefined);
});

test('#archive - compress file', () => {
return expect(call('archive', ['null:/filename'])).resolves.toBe(false);
});

test('#archive - decompress file', () => {
return expect(call('archive', ['null:/filename'])).resolves.toBe(false);
});

test('#archive - compress directory', () => {
return expect(call('archive', ['null:/directory'])).resolves.toBe(false);
});

test('#archive - decompress directory', () => {
return expect(call('archive', ['null:/directory'])).resolves.toBe(false);
});

test('#archive - compress multiple selections', () => {
return expect(
call('archive', ['null:/selection1', 'null:/selection2'])
).resolves.toBe(false);
});

test('#stat', () => {
return expect(call('stat', 'null:/filename'))
.resolves
Expand Down
58 changes: 30 additions & 28 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2197,20 +2197,21 @@ export type FilesystemMountpoint = {
* Filesystem Adapter Methods
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah. I can't see if these are tabs or note here. But wasn't this fixed in another commit ?

*/
export type FilesystemAdapterMethods = {
readdir: Function;
readfile: Function;
writefile: Function;
copy: Function;
move: Function;
rename: Function;
mkdir: Function;
unlink: Function;
exists: Function;
stat: Function;
url: Function;
download: Function;
search: Function;
touch: Function;
readdir: Function;
readfile: Function;
writefile: Function;
copy: Function;
move: Function;
rename: Function;
mkdir: Function;
unlink: Function;
exists: Function;
stat: Function;
url: Function;
download: Function;
search: Function;
touch: Function;
archive: Function;
};
export type FilesystemAdapterWrapper = () => FilesystemAdapterMethods;
/**
Expand Down Expand Up @@ -2258,20 +2259,21 @@ export type VFSServiceFilesystemContract = {
* VFS Service Contract
*/
export type VFSServiceContract = {
readdir: Function;
readfile: Function;
writefile: Function;
copy: Function;
move: Function;
rename: Function;
mkdir: Function;
unlink: Function;
exists: Function;
stat: Function;
url: Function;
download: Function;
search: Function;
touch: Function;
readdir: Function;
readfile: Function;
writefile: Function;
copy: Function;
move: Function;
rename: Function;
mkdir: Function;
unlink: Function;
exists: Function;
stat: Function;
url: Function;
download: Function;
search: Function;
touch: Function;
archive: Function;
};
/**
* VFS Service Options
Expand Down
Loading