test/mocks: add cockpit lib mocks
Add some stub functions for the cockpit library, these will be needed for tests to pass and for stubbing out the library for the service.
This commit is contained in:
parent
cb6f2573d0
commit
4235885541
2 changed files with 42 additions and 0 deletions
17
src/test/mocks/cockpit/fsinfo.ts
Normal file
17
src/test/mocks/cockpit/fsinfo.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
type fileinfo = {
|
||||
entries?: Record<string, fileinfo>;
|
||||
};
|
||||
|
||||
export const fsinfo = (
|
||||
path: string,
|
||||
attributes: (keyof fileinfo)[],
|
||||
options: object
|
||||
): Promise<fileinfo> => {
|
||||
return new Promise((resolve) => {
|
||||
resolve({
|
||||
entries: {},
|
||||
});
|
||||
});
|
||||
};
|
||||
25
src/test/mocks/cockpit/index.ts
Normal file
25
src/test/mocks/cockpit/index.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
type userinfo = {
|
||||
home: string;
|
||||
};
|
||||
|
||||
export default {
|
||||
user: (): Promise<userinfo> => {
|
||||
return new Promise((resolve) => {
|
||||
resolve({
|
||||
home: '',
|
||||
});
|
||||
});
|
||||
},
|
||||
file: (path: string) => {
|
||||
return {
|
||||
read: (): Promise<string> => {
|
||||
return new Promise((resolve) => {
|
||||
resolve('');
|
||||
});
|
||||
},
|
||||
close: () => {},
|
||||
};
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue