mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-05-19 22:34:45 +00:00
Fix: Remove event validation
This commit is contained in:
parent
16a133d9a7
commit
9572935725
9 changed files with 3 additions and 116 deletions
|
@ -4,7 +4,7 @@ import { promises as fs } from "fs";
|
|||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
|
||||
import { Events, Outputs, RefKey, State } from "../src/constants";
|
||||
import { Events, Outputs, State } from "../src/constants";
|
||||
import { ArtifactCacheEntry } from "../src/contracts";
|
||||
import * as actionUtils from "../src/utils/actionUtils";
|
||||
|
||||
|
@ -19,7 +19,6 @@ function getTempDir(): string {
|
|||
|
||||
afterEach(() => {
|
||||
delete process.env[Events.Key];
|
||||
delete process.env[RefKey];
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
@ -186,15 +185,6 @@ test("logWarning logs a message with a warning prefix", () => {
|
|||
expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`);
|
||||
});
|
||||
|
||||
test("isValidEvent returns false for event that does not have a branch or tag", () => {
|
||||
const event = "foo";
|
||||
process.env[Events.Key] = event;
|
||||
|
||||
const isValidEvent = actionUtils.isValidEvent();
|
||||
|
||||
expect(isValidEvent).toBe(false);
|
||||
});
|
||||
|
||||
test("resolvePaths with no ~ in path", async () => {
|
||||
const filePath = ".cache";
|
||||
|
||||
|
@ -326,16 +316,6 @@ test("resolvePaths exclusion pattern returns not found", async () => {
|
|||
}
|
||||
});
|
||||
|
||||
test("isValidEvent returns true for event that has a ref", () => {
|
||||
const event = Events.Push;
|
||||
process.env[Events.Key] = event;
|
||||
process.env[RefKey] = "ref/heads/feature";
|
||||
|
||||
const isValidEvent = actionUtils.isValidEvent();
|
||||
|
||||
expect(isValidEvent).toBe(true);
|
||||
});
|
||||
|
||||
test("unlinkFile unlinks file", async () => {
|
||||
const testDirectory = await fs.mkdtemp("unlinkFileTest");
|
||||
const testFile = path.join(testDirectory, "test.txt");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue