Fix tests
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user