1
0

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
+1
View File
@@ -4,6 +4,7 @@ logo.pxd
node_modules
.parcel-cache
dist
build
generated
.yarnrc.yml
*.test.js
+1
View File
@@ -0,0 +1 @@
18
+1 -1
View File
@@ -83,5 +83,5 @@ npm run watch
# Runs the silverbullet server
npm run server
# Builds (and watches for changes) all builtin plugs (in packages/plugs)
npm run plugs
npm run plugs -- <PATH-TO-YOUR-SPACE>
```
+1 -1
View File
@@ -10,7 +10,7 @@
"plugs": "cd packages/plugs && npm run watch",
"build-plugs": "cd packages/plugs && npm run build",
"server": "nodemon -w packages/server/dist --exec silverbullet",
"test": "jest packages/*/dist/test",
"test": "jest packages/*/{dist,build}/test",
"clean-build": "npm run clean && npm run build && npm i && npm run build-plugs",
"publish-all": "npm publish --access public --ws"
},
@@ -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 () => {