src/test/mocks: add cockpit mocks
Adds `mtime` tot fsinfo, and `replace` to `cockpit.file`.
This commit is contained in:
parent
c8c62dda9d
commit
75eb0afd10
2 changed files with 13 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
type fileinfo = {
|
||||
entries?: Record<string, fileinfo>;
|
||||
mtime: number;
|
||||
};
|
||||
|
||||
export const fsinfo = (
|
||||
|
|
@ -12,6 +13,7 @@ export const fsinfo = (
|
|||
return new Promise((resolve) => {
|
||||
resolve({
|
||||
entries: {},
|
||||
mtime: 1,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ export default {
|
|||
});
|
||||
},
|
||||
close: () => {},
|
||||
replace: (contents: string) => {},
|
||||
};
|
||||
},
|
||||
spawn: (args: string[], attributes: object): Promise<string | Uint8Array> => {
|
||||
|
|
@ -27,4 +28,14 @@ export default {
|
|||
resolve('');
|
||||
});
|
||||
},
|
||||
http: (address: string, options: object) => {
|
||||
return {
|
||||
get: (path?: string, headers?: object): string => {
|
||||
return '';
|
||||
},
|
||||
post: (path: string, data: object, headers?: object): string => {
|
||||
return '';
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue