refactor: add missing values to test

This commit is contained in:
Mauricio Siu
2025-01-19 01:21:03 -06:00
parent 52c83fd6fc
commit 43b7db00f9

View File

@@ -14,6 +14,9 @@ import {
import { beforeEach, expect, test, vi } from "vitest"; import { beforeEach, expect, test, vi } from "vitest";
const baseAdmin: Admin = { const baseAdmin: Admin = {
cleanupCacheApplications: false,
cleanupCacheOnCompose: false,
cleanupCacheOnPreviews: false,
createdAt: "", createdAt: "",
authId: "", authId: "",
adminId: "string", adminId: "string",
@@ -38,7 +41,7 @@ test("Should read the configuration file", () => {
const config: FileConfig = loadOrCreateConfig("dokploy"); const config: FileConfig = loadOrCreateConfig("dokploy");
expect(config.http?.routers?.["dokploy-router-app"]?.service).toBe( expect(config.http?.routers?.["dokploy-router-app"]?.service).toBe(
"dokploy-service-app", "dokploy-service-app"
); );
}); });
@@ -48,13 +51,13 @@ test("Should apply redirect-to-https", () => {
...baseAdmin, ...baseAdmin,
certificateType: "letsencrypt", certificateType: "letsencrypt",
}, },
"example.com", "example.com"
); );
const config: FileConfig = loadOrCreateConfig("dokploy"); const config: FileConfig = loadOrCreateConfig("dokploy");
expect(config.http?.routers?.["dokploy-router-app"]?.middlewares).toContain( expect(config.http?.routers?.["dokploy-router-app"]?.middlewares).toContain(
"redirect-to-https", "redirect-to-https"
); );
}); });
@@ -81,7 +84,7 @@ test("Should remove websecure if https rollback to http", () => {
updateServerTraefik( updateServerTraefik(
{ ...baseAdmin, certificateType: "letsencrypt" }, { ...baseAdmin, certificateType: "letsencrypt" },
"example.com", "example.com"
); );
updateServerTraefik({ ...baseAdmin, certificateType: "none" }, "example.com"); updateServerTraefik({ ...baseAdmin, certificateType: "none" }, "example.com");
@@ -90,6 +93,6 @@ test("Should remove websecure if https rollback to http", () => {
expect(config.http?.routers?.["dokploy-router-app-secure"]).toBeUndefined(); expect(config.http?.routers?.["dokploy-router-app-secure"]).toBeUndefined();
expect( expect(
config.http?.routers?.["dokploy-router-app"]?.middlewares, config.http?.routers?.["dokploy-router-app"]?.middlewares
).not.toContain("redirect-to-https"); ).not.toContain("redirect-to-https");
}); });