mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-12-25 06:17:02 +00:00
validate compression level input better
This commit is contained in:
parent
114dd526d5
commit
e4df80e331
3 changed files with 21 additions and 10 deletions
|
|
@ -197,12 +197,14 @@ test("getCompressionLevel allows zero for no compression", () => {
|
|||
expect(actionUtils.getCompressionLevel("foo")).toBe(0);
|
||||
});
|
||||
|
||||
test("getCompressionLevel returns undefined for negative values", () => {
|
||||
test("getCompressionLevel returns undefined and warns for negative values", () => {
|
||||
const infoMock = jest.spyOn(core, "info");
|
||||
|
||||
testUtils.setInput("foo", "-3");
|
||||
expect(actionUtils.getCompressionLevel("foo")).toBeUndefined();
|
||||
expect(infoMock).not.toHaveBeenCalledWith(expect.stringContaining("compression-level"));
|
||||
expect(infoMock).toHaveBeenCalledWith(
|
||||
"[warning]Invalid compression-level provided: -3. Expected a value between 0 (no compression) and 9 (maximum compression)."
|
||||
);
|
||||
});
|
||||
|
||||
test("getCompressionLevel returns undefined and warns if input is too large", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue