mirror of https://github.com/actions/toolkit
added test case
parent
a1a0cc7ebf
commit
ba1126827e
|
@ -32,3 +32,17 @@ test('assertDefined throws if undefined', () => {
|
|||
test('assertDefined returns value', () => {
|
||||
expect(cacheUtils.assertDefined('test', 5)).toBe(5)
|
||||
})
|
||||
|
||||
test("isFeatureAvailable returns true if server url is set", () => {
|
||||
try {
|
||||
process.env["ACTIONS_CACHE_URL"] = "http://cache.com";
|
||||
expect(cacheUtils.isFeatureAvailable()).toBe(true);
|
||||
} finally {
|
||||
delete process.env["ACTIONS_CACHE_URL"]
|
||||
}
|
||||
});
|
||||
|
||||
test("isFeatureAvailable returns false if server url is not set", () => {
|
||||
expect(cacheUtils.isFeatureAvailable()).toBe(false);
|
||||
});
|
||||
|
||||
|
|
|
@ -50,11 +50,7 @@ function checkKey(key: string): void {
|
|||
*/
|
||||
|
||||
export function isFeatureAvailable(): boolean {
|
||||
if (process.env['ACTIONS_CACHE_URL']) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return utils.isFeatureAvailable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -123,3 +123,11 @@ export function assertDefined<T>(name: string, value?: T): T {
|
|||
|
||||
return value
|
||||
}
|
||||
|
||||
export function isFeatureAvailable(): boolean {
|
||||
if (process.env["ACTIONS_CACHE_URL"]) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
Loading…
Reference in New Issue