mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-17 01:15:19 +00:00
test: update command generation tests to use mockResolvedValue
- Changed mockReturnValue to mockResolvedValue for getBuildCommand in deployApplication tests, ensuring asynchronous command generation is handled correctly. - Added rollbackRegistryId, rollbackRegistry, and deployments fields to application settings in drop and traefik tests for improved rollback functionality.
This commit is contained in:
@@ -189,7 +189,7 @@ describe("deployApplication - Command Generation Tests", () => {
|
|||||||
|
|
||||||
it("should verify nixpacks command is called with correct app", async () => {
|
it("should verify nixpacks command is called with correct app", async () => {
|
||||||
const mockNixpacksCommand = "nixpacks build /path/to/app --name test-app";
|
const mockNixpacksCommand = "nixpacks build /path/to/app --name test-app";
|
||||||
vi.mocked(builders.getBuildCommand).mockReturnValue(mockNixpacksCommand);
|
vi.mocked(builders.getBuildCommand).mockResolvedValue(mockNixpacksCommand);
|
||||||
|
|
||||||
await deployApplication({
|
await deployApplication({
|
||||||
applicationId: "test-app-id",
|
applicationId: "test-app-id",
|
||||||
@@ -220,7 +220,7 @@ describe("deployApplication - Command Generation Tests", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const mockRailpackCommand = "railpack prepare /path/to/app";
|
const mockRailpackCommand = "railpack prepare /path/to/app";
|
||||||
vi.mocked(builders.getBuildCommand).mockReturnValue(mockRailpackCommand);
|
vi.mocked(builders.getBuildCommand).mockResolvedValue(mockRailpackCommand);
|
||||||
|
|
||||||
await deployApplication({
|
await deployApplication({
|
||||||
applicationId: "test-app-id",
|
applicationId: "test-app-id",
|
||||||
@@ -241,7 +241,7 @@ describe("deployApplication - Command Generation Tests", () => {
|
|||||||
|
|
||||||
it("should execute commands in correct order", async () => {
|
it("should execute commands in correct order", async () => {
|
||||||
const mockNixpacksCommand = "nixpacks build";
|
const mockNixpacksCommand = "nixpacks build";
|
||||||
vi.mocked(builders.getBuildCommand).mockReturnValue(mockNixpacksCommand);
|
vi.mocked(builders.getBuildCommand).mockResolvedValue(mockNixpacksCommand);
|
||||||
|
|
||||||
await deployApplication({
|
await deployApplication({
|
||||||
applicationId: "test-app-id",
|
applicationId: "test-app-id",
|
||||||
@@ -260,7 +260,7 @@ describe("deployApplication - Command Generation Tests", () => {
|
|||||||
|
|
||||||
it("should include log redirection in command", async () => {
|
it("should include log redirection in command", async () => {
|
||||||
const mockCommand = "nixpacks build";
|
const mockCommand = "nixpacks build";
|
||||||
vi.mocked(builders.getBuildCommand).mockReturnValue(mockCommand);
|
vi.mocked(builders.getBuildCommand).mockResolvedValue(mockCommand);
|
||||||
|
|
||||||
await deployApplication({
|
await deployApplication({
|
||||||
applicationId: "test-app-id",
|
applicationId: "test-app-id",
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ const baseApp: ApplicationNested = {
|
|||||||
giteaRepository: "",
|
giteaRepository: "",
|
||||||
cleanCache: false,
|
cleanCache: false,
|
||||||
watchPaths: [],
|
watchPaths: [],
|
||||||
|
rollbackRegistryId: "",
|
||||||
|
rollbackRegistry: null,
|
||||||
|
deployments: [],
|
||||||
enableSubmodules: false,
|
enableSubmodules: false,
|
||||||
applicationStatus: "done",
|
applicationStatus: "done",
|
||||||
triggerType: "push",
|
triggerType: "push",
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ const baseApp: ApplicationNested = {
|
|||||||
giteaBuildPath: "",
|
giteaBuildPath: "",
|
||||||
giteaId: "",
|
giteaId: "",
|
||||||
args: [],
|
args: [],
|
||||||
|
rollbackRegistryId: "",
|
||||||
|
rollbackRegistry: null,
|
||||||
|
deployments: [],
|
||||||
cleanCache: false,
|
cleanCache: false,
|
||||||
applicationStatus: "done",
|
applicationStatus: "done",
|
||||||
endpointSpecSwarm: null,
|
endpointSpecSwarm: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user