@@ -237,6 +237,59 @@ describe("addDomainToCompose enabled filtering", () => {
237237 } ,
238238 ) ;
239239
240+ it . each ( [
241+ [
242+ "docker-compose" ,
243+ `services:
244+ frigate:
245+ image: frigate
246+ labels:
247+ traefik.enable: "true"
248+ traefik.http.routers.test-app-1-web.rule: Host(\`old.example.com\`)
249+ traefik.http.services.test-app-1-web.loadbalancer.server.port: 8971
250+ custom.label: preserved
251+ ` ,
252+ "traefik.docker.network" ,
253+ ] ,
254+ [
255+ "stack" ,
256+ `services:
257+ frigate:
258+ image: frigate
259+ deploy:
260+ labels:
261+ traefik.enable: "true"
262+ traefik.http.routers.test-app-1-web.rule: Host(\`old.example.com\`)
263+ traefik.http.services.test-app-1-web.loadbalancer.server.port: 8971
264+ custom.label: preserved
265+ ` ,
266+ "traefik.swarm.network" ,
267+ ] ,
268+ ] as const ) (
269+ "regenerates routing in mapping labels for an enabled domain in %s" ,
270+ async ( composeType , mappingComposeYaml , networkLabel ) => {
271+ composeYaml = mappingComposeYaml ;
272+
273+ const result = await addDomainToCompose ( { ...baseCompose , composeType } , [
274+ { ...baseDomain , enabled : true } ,
275+ ] ) ;
276+
277+ const service = result ?. services ?. frigate ;
278+ const labels =
279+ composeType === "docker-compose"
280+ ? service ?. labels
281+ : service ?. deploy ?. labels ;
282+ expect ( labels ) . toMatchObject ( {
283+ "custom.label" : "preserved" ,
284+ "traefik.enable" : "true" ,
285+ [ networkLabel ] : "dokploy-network" ,
286+ "traefik.http.routers.test-app-1-web.rule" :
287+ "Host(`frigate.example.com`)" ,
288+ "traefik.http.services.test-app-1-web.loadbalancer.server.port" : "8971" ,
289+ } ) ;
290+ } ,
291+ ) ;
292+
240293 it ( "emits labels only for the enabled domain when both are present" , async ( ) => {
241294 const result = await addDomainToCompose ( baseCompose , [
242295 { ...baseDomain , host : "enabled.example.com" , enabled : true } ,
0 commit comments