mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-20 19:18:45 +00:00
test: update mock implementation in application.real.test.ts
- Replaced the mock for the patch service with a mock for db.query.patch.findMany to better simulate database behavior. - Added type and updatedAt fields to the mock patch object for improved test accuracy.
This commit is contained in:
@@ -104,7 +104,6 @@ import * as adminService from "@dokploy/server/services/admin";
|
|||||||
import * as applicationService from "@dokploy/server/services/application";
|
import * as applicationService from "@dokploy/server/services/application";
|
||||||
import { deployApplication } from "@dokploy/server/services/application";
|
import { deployApplication } from "@dokploy/server/services/application";
|
||||||
import * as deploymentService from "@dokploy/server/services/deployment";
|
import * as deploymentService from "@dokploy/server/services/deployment";
|
||||||
import * as patchService from "@dokploy/server/services/patch";
|
|
||||||
import { mkdtemp, writeFile } from "node:fs/promises";
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
@@ -554,8 +553,8 @@ describe(
|
|||||||
// 3. Patch content is the raw file content (not a diff)
|
// 3. Patch content is the raw file content (not a diff)
|
||||||
const newContent = "print('Patched App')\n";
|
const newContent = "print('Patched App')\n";
|
||||||
|
|
||||||
// 4. Mock patch service to return this patch
|
// 4. Mock db.query.patch.findMany - generateApplyPatchesCommand uses this via findPatchesByEntityId
|
||||||
vi.mocked(patchService.findPatchesByEntityId).mockResolvedValue([
|
vi.mocked(db.query.patch.findMany).mockResolvedValue([
|
||||||
{
|
{
|
||||||
patchId: "test-patch-1",
|
patchId: "test-patch-1",
|
||||||
applicationId: "test-app-id",
|
applicationId: "test-app-id",
|
||||||
@@ -563,7 +562,9 @@ describe(
|
|||||||
filePath: "app.py",
|
filePath: "app.py",
|
||||||
content: newContent,
|
content: newContent,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
type: "update",
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
} as any,
|
} as any,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user