Просмотр исходного кода

refs 116148: add test where app site url hash settings is off

Futa Arai 3 лет назад
Родитель
Сommit
268ca63da2
1 измененных файлов с 15 добавлено и 2 удалено
  1. 15 2
      packages/app/test/integration/service/questionnaire.test.ts

+ 15 - 2
packages/app/test/integration/service/questionnaire.test.ts

@@ -11,7 +11,6 @@ describe('QuestionnaireService', () => {
 
   beforeAll(async() => {
     process.env.APP_SITE_URL = 'http://growi.test.jp';
-    process.env.QUESTIONNAIRE_IS_APP_SITE_URL_HASHED = 'false';
     process.env.DEPLOYMENT_TYPE = 'growi-docker-compose';
     process.env.SAML_ENABLED = 'true';
     crowi = await getInstance();
@@ -51,7 +50,7 @@ describe('QuestionnaireService', () => {
 
       expect(growiInfo).toEqual({
         activeExternalAccountTypes: ['saml', 'github'],
-        appSiteUrl: 'http://growi.test.jp',
+        appSiteUrl: null,
         attachmentType: 'aws',
         deploymentType: 'growi-docker-compose',
         type: 'on-premise',
@@ -59,6 +58,20 @@ describe('QuestionnaireService', () => {
         wikiType: 'open',
       });
     });
+
+    describe('When url hash settings is off', () => {
+      beforeEach(async() => {
+        process.env.QUESTIONNAIRE_IS_APP_SITE_URL_HASHED = 'false';
+        await crowi.setupConfigManager();
+      });
+
+      test('Should return app url string', async() => {
+        const growiInfo = await crowi.questionnaireService.getGrowiInfo();
+        expect(growiInfo.appSiteUrl).toBe('http://growi.test.jp');
+        expect(growiInfo.appSiteUrlHashed).not.toBe('http://growi.test.jp');
+        expect(growiInfo.appSiteUrlHashed).toBeTruthy();
+      });
+    });
   });
 
   describe('getUserInfo', () => {