Browse Source

test: adapt tests to support new APP_DOMAIN

Nicolas Meienberger 2 years ago
parent
commit
f6bd298ff3

+ 1 - 2
packages/system-api/src/modules/apps/__tests__/apps.helpers.test.ts

@@ -220,7 +220,6 @@ describe('generateEnvFile', () => {
     const envmap = await getEnvMap(appInfo.id);
 
     expect(envmap.get('APP_EXPOSED')).toBeUndefined();
-    expect(envmap.get('APP_DOMAIN')).toBeUndefined();
   });
 
   it('Should not add APP_EXPOSED if app is not exposed', async () => {
@@ -233,7 +232,7 @@ describe('generateEnvFile', () => {
     const envmap = await getEnvMap(appInfo.id);
 
     expect(envmap.get('APP_EXPOSED')).toBeUndefined();
-    expect(envmap.get('APP_DOMAIN')).toBeUndefined();
+    expect(envmap.get('APP_DOMAIN')).toBe(`192.168.1.10:${appInfo.port}`);
   });
 });
 

+ 3 - 3
packages/system-api/src/modules/apps/__tests__/apps.service.test.ts

@@ -45,7 +45,7 @@ describe('Install app', () => {
     await AppsService.installApp(app1.id, { TEST_FIELD: 'test' });
     const envFile = fs.readFileSync(`${config.ROOT_FOLDER}/app-data/${app1.id}/app.env`).toString();
 
-    expect(envFile.trim()).toBe(`TEST=test\nAPP_PORT=${app1.port}\nTEST_FIELD=test`);
+    expect(envFile.trim()).toBe(`TEST=test\nAPP_PORT=${app1.port}\nTEST_FIELD=test\nAPP_DOMAIN=192.168.1.10:${app1.port}`);
   });
 
   it('Should add app in database', async () => {
@@ -272,7 +272,7 @@ describe('Start app', () => {
 
     const envFile = fs.readFileSync(`${config.ROOT_FOLDER}/app-data/${app1.id}/app.env`).toString();
 
-    expect(envFile.trim()).toBe(`TEST=test\nAPP_PORT=${app1.port}\nTEST_FIELD=test`);
+    expect(envFile.trim()).toBe(`TEST=test\nAPP_PORT=${app1.port}\nTEST_FIELD=test\nAPP_DOMAIN=192.168.1.10:${app1.port}`);
   });
 
   it('Should throw if start script fails', async () => {
@@ -336,7 +336,7 @@ describe('Update app config', () => {
 
     const envFile = fs.readFileSync(`${config.ROOT_FOLDER}/app-data/${app1.id}/app.env`).toString();
 
-    expect(envFile.trim()).toBe(`TEST=test\nAPP_PORT=${app1.port}\nTEST_FIELD=test`);
+    expect(envFile.trim()).toBe(`TEST=test\nAPP_PORT=${app1.port}\nTEST_FIELD=test\nAPP_DOMAIN=192.168.1.10:${app1.port}`);
   });
 
   it('Should throw if required field is missing', async () => {