Fix tests

This commit is contained in:
Zef Hemel
2022-07-04 09:34:11 +02:00
parent 25188f94b1
commit 66c21c4c6b
8 changed files with 18 additions and 5 deletions
@@ -2,4 +2,14 @@ declare global {
function syscall(name: string, ...args: any[]): Promise<any>;
}
// This is the case when running tests only, so giving it a dummy syscall function
if (typeof self === "undefined") {
// @ts-ignore
self = {
syscall: (name: string, ...args: any[]) => {
throw new Error("Not implemented here");
},
};
}
export const syscall = self.syscall;
+1 -1
View File
@@ -137,7 +137,7 @@ parentPort.on("message", (data: any) => {
}
pendingRequests.delete(syscallId);
if (data.error) {
console.log("Got rejection", data.error);
// console.log("Got rejection", data.error);
lookup.reject(new Error(data.error));
} else {
lookup.resolve(data.result);
+1
View File
@@ -46,4 +46,5 @@ test("Run a plugos endpoint server", async () => {
expect(resp.text).toBe(JSON.stringify([1, 2, 3]));
});
server.close();
await system.unloadAll();
});
+2 -2
View File
@@ -9,7 +9,7 @@ beforeEach(async () => {
db = knex({
client: "better-sqlite3",
connection: {
filename: "test.db",
filename: "auth-test.db",
},
useNullAsDefault: true,
});
@@ -17,7 +17,7 @@ beforeEach(async () => {
afterEach(async () => {
db!.destroy();
await unlink("test.db");
await unlink("auth-test.db");
});
test("Test auth", async () => {