File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed
Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 11import type { Hostname } from '../../types' ;
22import Constants from '../constants' ;
3- import { isEnterpriseHost } from '../helpers' ;
3+ import { isEnterpriseServerHost } from '../helpers' ;
44
55export function getGitHubAPIBaseUrl ( hostname : Hostname ) : URL {
66 const url = new URL ( Constants . GITHUB_API_BASE_URL ) ;
77
8- if ( isEnterpriseHost ( hostname ) ) {
8+ if ( isEnterpriseServerHost ( hostname ) ) {
99 url . hostname = hostname ;
1010 url . pathname = '/api/v3/' ;
1111 }
@@ -15,7 +15,7 @@ export function getGitHubAPIBaseUrl(hostname: Hostname): URL {
1515export function getGitHubGraphQLUrl ( hostname : Hostname ) : URL {
1616 const url = new URL ( Constants . GITHUB_API_GRAPHQL_URL ) ;
1717
18- if ( isEnterpriseHost ( hostname ) ) {
18+ if ( isEnterpriseServerHost ( hostname ) ) {
1919 url . hostname = hostname ;
2020 url . pathname = '/api/graphql' ;
2121 }
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import {
1616 generateNotificationReferrerId ,
1717 getFilterCount ,
1818 getPlatformFromHostname ,
19- isEnterpriseHost ,
19+ isEnterpriseServerHost ,
2020} from './helpers' ;
2121
2222describe ( 'utils/helpers.ts' , ( ) => {
@@ -40,15 +40,19 @@ describe('utils/helpers.ts', () => {
4040 } ) ;
4141 } ) ;
4242
43- describe ( 'isEnterpriseHost ' , ( ) => {
43+ describe ( 'isEnterpriseServerHost ' , ( ) => {
4444 it ( 'should return true for enterprise host' , ( ) => {
45- expect ( isEnterpriseHost ( 'github.gitify.app' as Hostname ) ) . toBe ( true ) ;
46- expect ( isEnterpriseHost ( 'api.github.gitify.app' as Hostname ) ) . toBe ( true ) ;
45+ expect ( isEnterpriseServerHost ( 'github.gitify.app' as Hostname ) ) . toBe (
46+ true ,
47+ ) ;
48+ expect ( isEnterpriseServerHost ( 'api.github.gitify.app' as Hostname ) ) . toBe (
49+ true ,
50+ ) ;
4751 } ) ;
4852
4953 it ( 'should return false for non-enterprise host' , ( ) => {
50- expect ( isEnterpriseHost ( 'github.com' as Hostname ) ) . toBe ( false ) ;
51- expect ( isEnterpriseHost ( 'api.github.com' as Hostname ) ) . toBe ( false ) ;
54+ expect ( isEnterpriseServerHost ( 'github.com' as Hostname ) ) . toBe ( false ) ;
55+ expect ( isEnterpriseServerHost ( 'api.github.com' as Hostname ) ) . toBe ( false ) ;
5256 } ) ;
5357 } ) ;
5458
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export function getPlatformFromHostname(hostname: string): PlatformType {
1717 : 'GitHub Enterprise Server' ;
1818}
1919
20- export function isEnterpriseHost ( hostname : Hostname ) : boolean {
20+ export function isEnterpriseServerHost ( hostname : Hostname ) : boolean {
2121 return ! hostname . endsWith ( Constants . DEFAULT_AUTH_OPTIONS . hostname ) ;
2222}
2323
You can’t perform that action at this time.
0 commit comments