fix(test): repair placeholder tests referencing deleted @bete/shared package
packages/shared dihapus (5802d02), modul pindah ke src/shared/. Update
import placeholder.test.ts (gateway + backend) ke path lokal + aktifkan
tests/ di backend vitest config dengan alias @. Sebelumnya vitest run
gateway selalu gagal; sekarang 60+36 tests pass.
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
// ─── Shared Error Classes ────────────────────────────────────────────────────
|
// ─── Shared Error Classes ────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||||
import {
|
import {
|
||||||
AppError,
|
AppError,
|
||||||
ConfigError,
|
ConfigError,
|
||||||
@@ -6,7 +8,9 @@ import {
|
|||||||
NotFoundError,
|
NotFoundError,
|
||||||
UnauthorizedError,
|
UnauthorizedError,
|
||||||
ValidationError,
|
ValidationError,
|
||||||
} from "@bete/shared/errors";
|
} from "../src/shared/errors/index.js";
|
||||||
|
// ─── Backend middleware ──────────────────────────────────────────────────────
|
||||||
|
import { asyncHandler, requireParam } from "../src/shared/middlewares/index.js";
|
||||||
// ─── Shared utilities ─────────────────────────────────────────────────────────
|
// ─── Shared utilities ─────────────────────────────────────────────────────────
|
||||||
import {
|
import {
|
||||||
decodeCursor,
|
decodeCursor,
|
||||||
@@ -14,11 +18,7 @@ import {
|
|||||||
encodeCursor,
|
encodeCursor,
|
||||||
pageResult,
|
pageResult,
|
||||||
retryWithBackoff,
|
retryWithBackoff,
|
||||||
} from "@bete/shared/utils";
|
} from "../src/shared/utils/index.js";
|
||||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
||||||
|
|
||||||
// ─── Backend middleware ──────────────────────────────────────────────────────
|
|
||||||
import { asyncHandler, requireParam } from "../src/shared/middlewares/index.js";
|
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════════
|
||||||
// 1. AppError / Error Hierarchy Tests
|
// 1. AppError / Error Hierarchy Tests
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||||
|
},
|
||||||
|
},
|
||||||
test: {
|
test: {
|
||||||
globals: true,
|
globals: true,
|
||||||
environment: "node",
|
environment: "node",
|
||||||
include: ["src/**/*.test.ts"],
|
include: ["src/**/*.test.ts", "tests/**/*.test.ts"],
|
||||||
testTimeout: 15000,
|
testTimeout: 15000,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
NotFoundError,
|
NotFoundError,
|
||||||
UnauthorizedError,
|
UnauthorizedError,
|
||||||
ValidationError,
|
ValidationError,
|
||||||
} from "@bete/shared/errors";
|
} from "../src/shared/errors/index.js";
|
||||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
describe("AppError subclasses", () => {
|
describe("AppError subclasses", () => {
|
||||||
@@ -52,7 +52,7 @@ import {
|
|||||||
encodeCursor,
|
encodeCursor,
|
||||||
pageResult,
|
pageResult,
|
||||||
retryWithBackoff,
|
retryWithBackoff,
|
||||||
} from "@bete/shared/utils";
|
} from "../src/shared/utils/index.js";
|
||||||
|
|
||||||
describe("delay", () => {
|
describe("delay", () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -146,7 +146,7 @@ import {
|
|||||||
DISCORD_VOICE_STARTED,
|
DISCORD_VOICE_STARTED,
|
||||||
MEDIA_STATUS_KEY,
|
MEDIA_STATUS_KEY,
|
||||||
VOICE_STATUS_KEY,
|
VOICE_STATUS_KEY,
|
||||||
} from "@bete/shared/redis-channels";
|
} from "../src/shared/redis-channels.js";
|
||||||
|
|
||||||
describe("Redis channel constants", () => {
|
describe("Redis channel constants", () => {
|
||||||
it("define event channel names", () => {
|
it("define event channel names", () => {
|
||||||
@@ -186,7 +186,7 @@ vi.hoisted(() => {
|
|||||||
process.env.DATABASE_URL = "postgres://test:test@localhost:5432/test";
|
process.env.DATABASE_URL = "postgres://test:test@localhost:5432/test";
|
||||||
});
|
});
|
||||||
|
|
||||||
import { configSchema, loadConfig } from "@bete/shared/config";
|
import { configSchema, loadConfig } from "../src/shared/config/index.js";
|
||||||
|
|
||||||
describe("Config validation", () => {
|
describe("Config validation", () => {
|
||||||
it("loadConfig succeeds with minimal valid env", () => {
|
it("loadConfig succeeds with minimal valid env", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user