Add isGhes gate and refactor to clean up circular dependencies

This commit is contained in:
Bassem Dghaidi
2024-11-21 04:01:44 -08:00
committed by GitHub
parent ab58a59f33
commit 267841d7bd
8 changed files with 79 additions and 64 deletions

View File

@@ -1,4 +1,4 @@
import {promises as fs} from 'fs'
import { promises as fs } from 'fs'
import * as path from 'path'
import * as cacheUtils from '../src/internal/cacheUtils'
@@ -42,23 +42,3 @@ test('resolvePaths works on github workspace directory', async () => {
const paths = await cacheUtils.resolvePaths([workspace])
expect(paths.length).toBeGreaterThan(0)
})
test('isGhes returns false for github.com', async () => {
process.env.GITHUB_SERVER_URL = 'https://github.com'
expect(cacheUtils.isGhes()).toBe(false)
})
test('isGhes returns false for ghe.com', async () => {
process.env.GITHUB_SERVER_URL = 'https://somedomain.ghe.com'
expect(cacheUtils.isGhes()).toBe(false)
})
test('isGhes returns true for enterprise URL', async () => {
process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com'
expect(cacheUtils.isGhes()).toBe(true)
})
test('isGhes returns false for ghe.localhost', () => {
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost'
expect(cacheUtils.isGhes()).toBe(false)
})