chore: Test performance (#5786)

This commit is contained in:
Tom Moor
2023-09-06 17:19:21 -04:00
committed by GitHub
parent 3eb947e9a5
commit ec0564eb32
69 changed files with 449 additions and 617 deletions

View File

@@ -1,12 +1,9 @@
import { Backlink } from "@server/models";
import { buildDocument } from "@server/test/factories";
import { setupTestDatabase } from "@server/test/support";
import BacklinksProcessor from "./BacklinksProcessor";
const ip = "127.0.0.1";
setupTestDatabase();
describe("documents.publish", () => {
test("should create new backlink records", async () => {
const otherDocument = await buildDocument();

View File

@@ -1,12 +1,9 @@
import { Revision } from "@server/models";
import { buildDocument } from "@server/test/factories";
import { setupTestDatabase } from "@server/test/support";
import RevisionsProcessor from "./RevisionsProcessor";
const ip = "127.0.0.1";
setupTestDatabase();
describe("documents.update.debounced", () => {
test("should create a revision", async () => {
const document = await buildDocument();

View File

@@ -1,10 +1,12 @@
import path from "path";
import { glob } from "glob";
import env from "@server/env";
import Logger from "@server/logging/Logger";
import { requireDirectory } from "@server/utils/fs";
import BaseProcessor from "./BaseProcessor";
const processors = {};
const rootDir = env.ENVIRONMENT === "test" ? "" : "build";
requireDirectory<{ default: BaseProcessor }>(__dirname).forEach(
([module, id]) => {
@@ -16,7 +18,7 @@ requireDirectory<{ default: BaseProcessor }>(__dirname).forEach(
);
glob
.sync("build/plugins/*/server/processors/!(*.test).js")
.sync(path.join(rootDir, "plugins/*/server/processors/!(*.test).[jt]s"))
.forEach((filePath: string) => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const processor = require(path.join(process.cwd(), filePath)).default;