mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-29 16:04:14 +00:00
restructure to single project
This commit is contained in:
committed by
TheArcaneBrony
parent
5abd6bb7e0
commit
5e86d7ab9c
@@ -0,0 +1,23 @@
|
||||
const { performance } = require("perf_hooks");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
// fs.unlinkSync(path.join(__dirname, "..", "database.db"));
|
||||
|
||||
global.expect.extend({
|
||||
toBeFasterThan: async (func, target) => {
|
||||
const start = performance.now();
|
||||
let error;
|
||||
try {
|
||||
await func();
|
||||
} catch (e) {
|
||||
error = e.toString();
|
||||
}
|
||||
const time = performance.now() - start;
|
||||
|
||||
return {
|
||||
pass: time < target && !error,
|
||||
message: () => error || `${func.name} took ${time}ms of maximum ${target}`,
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user