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:
Gianluca Zuccarelli 2024-12-17 11:50:20 +00:00 committed by Lucas Garfield
parent cb6f2573d0
commit 4235885541
2 changed files with 42 additions and 0 deletions

View 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: {},
});
});
};

View 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: () => {},
};
},
};