Skip to content

Commit 22450ab

Browse files
committed
fix: satisfy HttpRouter type in traefik config test
Test routers were missing the required "service" field, and mock.calls[0] destructuring failed under noUncheckedIndexedAccess.
1 parent bfc180d commit 22450ab

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

‎apps/dokploy/__test__/traefik/write-app-traefik-config.test.ts‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ describe("writeAppTraefikConfig", () => {
6060
await writeAppTraefikConfig(
6161
{
6262
http: {
63-
routers: { [`${appName}-router-1`]: { rule: "Host(`x`)" } },
63+
routers: {
64+
[`${appName}-router-1`]: {
65+
rule: "Host(`x`)",
66+
service: `${appName}-service`,
67+
},
68+
},
6469
services: {},
6570
},
6671
},
@@ -80,7 +85,7 @@ describe("writeAppTraefikConfig", () => {
8085
);
8186

8287
expect(mocks.execAsyncRemote).toHaveBeenCalledOnce();
83-
const [, command] = mocks.execAsyncRemote.mock.calls[0];
88+
const [, command] = mocks.execAsyncRemote.mock.calls[0] ?? [];
8489
expect(command).toMatch(/^rm -f /);
8590
expect(command).toContain("no-domain-app.yml");
8691
});
@@ -91,7 +96,12 @@ describe("writeAppTraefikConfig", () => {
9196
await writeAppTraefikConfig(
9297
{
9398
http: {
94-
routers: { "with-domain-app-router-1": { rule: "Host(`x`)" } },
99+
routers: {
100+
"with-domain-app-router-1": {
101+
rule: "Host(`x`)",
102+
service: "with-domain-app-service",
103+
},
104+
},
95105
services: {},
96106
},
97107
},
@@ -100,7 +110,7 @@ describe("writeAppTraefikConfig", () => {
100110
);
101111

102112
expect(mocks.execAsyncRemote).toHaveBeenCalledOnce();
103-
const [, command] = mocks.execAsyncRemote.mock.calls[0];
113+
const [, command] = mocks.execAsyncRemote.mock.calls[0] ?? [];
104114
expect(command).toMatch(/^echo /);
105115
});
106116
});

0 commit comments

Comments
 (0)