diff --git a/packages/artifact/__tests__/config.test.ts b/packages/artifact/__tests__/config.test.ts index d1d86049..5afed94d 100644 --- a/packages/artifact/__tests__/config.test.ts +++ b/packages/artifact/__tests__/config.test.ts @@ -1,29 +1,27 @@ import * as config from '../src/internal/shared/config' - beforeEach(() => { - jest.resetModules() - }); - + jest.resetModules() +}) describe('isGhes', () => { - it('should return false when the request domain is github.com', () => { - process.env.GITHUB_SERVER_URL = 'https://github.com' - expect(config.isGhes()).toBe(false) - }) + it('should return false when the request domain is github.com', () => { + process.env.GITHUB_SERVER_URL = 'https://github.com' + expect(config.isGhes()).toBe(false) + }) - it('should return false when the request domain ends with ghe.com', () => { - process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.com' - expect(config.isGhes()).toBe(false) - }) + it('should return false when the request domain ends with ghe.com', () => { + process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.com' + expect(config.isGhes()).toBe(false) + }) - it('should return false when the request domain ends with ghe.localhost', () => { - process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost' - expect(config.isGhes()).toBe(false) - }) + it('should return false when the request domain ends with ghe.localhost', () => { + process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost' + expect(config.isGhes()).toBe(false) + }) - it('should return false when the request domain is specific to an enterprise', () => { - process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com' - expect(config.isGhes()).toBe(true) - }) -}) \ No newline at end of file + it('should return false when the request domain is specific to an enterprise', () => { + process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com' + expect(config.isGhes()).toBe(true) + }) +}) diff --git a/packages/artifact/src/internal/shared/config.ts b/packages/artifact/src/internal/shared/config.ts index fc39a1c9..089fae14 100644 --- a/packages/artifact/src/internal/shared/config.ts +++ b/packages/artifact/src/internal/shared/config.ts @@ -29,8 +29,9 @@ export function isGhes(): boolean { ) const hostname = ghUrl.hostname.trimEnd().toUpperCase() - const isGitHubHost = (hostname == 'GITHUB.COM') - const isGheHost = (hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST')) + const isGitHubHost = hostname === 'GITHUB.COM' + const isGheHost = + hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST') return !isGitHubHost && !isGheHost } diff --git a/packages/cache/__tests__/cacheUtils.test.ts b/packages/cache/__tests__/cacheUtils.test.ts index 9a4166cb..4388026a 100644 --- a/packages/cache/__tests__/cacheUtils.test.ts +++ b/packages/cache/__tests__/cacheUtils.test.ts @@ -3,8 +3,8 @@ import * as path from 'path' import * as cacheUtils from '../src/internal/cacheUtils' beforeEach(() => { - jest.resetModules() -}); + jest.resetModules() +}) test('getArchiveFileSizeInBytes returns file size', () => { const filePath = path.join(__dirname, '__fixtures__', 'helloWorld.txt') @@ -61,4 +61,4 @@ test('isGhes returns true for enterprise URL', async () => { test('isGhes returns false for ghe.localhost', () => { process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost' expect(cacheUtils.isGhes()).toBe(false) -}) \ No newline at end of file +}) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index 8bc3ce23..91bae9a8 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -137,8 +137,9 @@ export function isGhes(): boolean { ) const hostname = ghUrl.hostname.trimEnd().toUpperCase() - const isGitHubHost = (hostname == 'GITHUB.COM') - const isGheHost = (hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST')) + const isGitHubHost = hostname === 'GITHUB.COM' + const isGheHost = + hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST') return !isGitHubHost && !isGheHost }