@@ -15,6 +15,7 @@ import {
1515 generateNotificationReferrerId ,
1616 getChevronDetails ,
1717 getPlatformFromHostname ,
18+ isCloudDataResidencyHost ,
1819 isEnterpriseServerHost ,
1920 parseInlineCode ,
2021} from './helpers' ;
@@ -38,10 +39,38 @@ describe('renderer/utils/helpers.ts', () => {
3839 'GitHub Enterprise Server' ,
3940 ) ;
4041 } ) ;
42+
43+ it ( 'should return GitHub Enterprise Cloud with Data Residency for ghe.com domains' , ( ) => {
44+ expect ( getPlatformFromHostname ( 'gitify.ghe.com' as Hostname ) ) . toBe (
45+ 'GitHub Enterprise Cloud with Data Residency' ,
46+ ) ;
47+ expect ( getPlatformFromHostname ( 'acme-corp.ghe.com' as Hostname ) ) . toBe (
48+ 'GitHub Enterprise Cloud with Data Residency' ,
49+ ) ;
50+ } ) ;
51+ } ) ;
52+
53+ describe ( 'isCloudDataResidencyHost' , ( ) => {
54+ it ( 'should return true for ghe.com hosts' , ( ) => {
55+ expect ( isCloudDataResidencyHost ( 'gitify.ghe.com' as Hostname ) ) . toBe ( true ) ;
56+ expect ( isCloudDataResidencyHost ( 'acme-corp.ghe.com' as Hostname ) ) . toBe (
57+ true ,
58+ ) ;
59+ } ) ;
60+
61+ it ( 'should return false for non ghe.com hosts' , ( ) => {
62+ expect ( isCloudDataResidencyHost ( 'github.com' as Hostname ) ) . toBe ( false ) ;
63+ expect ( isCloudDataResidencyHost ( 'api.github.com' as Hostname ) ) . toBe (
64+ false ,
65+ ) ;
66+ expect ( isCloudDataResidencyHost ( 'github.gitify.app' as Hostname ) ) . toBe (
67+ false ,
68+ ) ;
69+ } ) ;
4170 } ) ;
4271
4372 describe ( 'isEnterpriseServerHost' , ( ) => {
44- it ( 'should return true for enterprise host' , ( ) => {
73+ it ( 'should return true for enterprise server host' , ( ) => {
4574 expect ( isEnterpriseServerHost ( 'github.gitify.app' as Hostname ) ) . toBe (
4675 true ,
4776 ) ;
@@ -50,10 +79,17 @@ describe('renderer/utils/helpers.ts', () => {
5079 ) ;
5180 } ) ;
5281
53- it ( 'should return false for non-enterprise host' , ( ) => {
82+ it ( 'should return false for github.com host' , ( ) => {
5483 expect ( isEnterpriseServerHost ( 'github.com' as Hostname ) ) . toBe ( false ) ;
5584 expect ( isEnterpriseServerHost ( 'api.github.com' as Hostname ) ) . toBe ( false ) ;
5685 } ) ;
86+
87+ it ( 'should return false for ghe.com host' , ( ) => {
88+ expect ( isEnterpriseServerHost ( 'gitify.ghe.com' as Hostname ) ) . toBe ( false ) ;
89+ expect ( isEnterpriseServerHost ( 'acme-corp.ghe.com' as Hostname ) ) . toBe (
90+ false ,
91+ ) ;
92+ } ) ;
5793 } ) ;
5894
5995 describe ( 'generateNotificationReferrerId' , ( ) => {
0 commit comments