Compare commits

..

1 Commits

Author SHA1 Message Date
t.behrendt 30070f7f9c refactor: to node action (#47)
CD / Release (push) Successful in 33s
Refactoring the action from a composite to Node action. This change improves security through pinning of packages as well as better test-ability and error handling.

Reviewed-on: #47
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2026-06-27 14:00:15 +02:00
2 changed files with 9 additions and 13 deletions
-4
View File
@@ -13,10 +13,6 @@ jobs:
uses: ./
with:
json-file: renovate.json
- name: Validate oxfmt config
uses: ./
with:
json-file: .oxfmtrc.json
test:
name: Test
+9 -9
View File
@@ -31,7 +31,7 @@ describe("validateJson()", () => {
despiteThisBeingValidJson: "toString() breaks it, making it invalid",
}.toString();
await expect(validateJson(jsonFile)).rejects.toThrow(
'"[object Object]" is not valid JSON'
'"[object Object]" is not valid JSON',
);
});
@@ -40,7 +40,7 @@ describe("validateJson()", () => {
validJson: true,
});
await expect(validateJson(jsonFile)).rejects.toThrow(
"No schema found in JSON file."
"No schema found in JSON file.",
);
});
@@ -48,7 +48,7 @@ describe("validateJson()", () => {
vi.mocked(fetch).mockRejectedValue(new Error("Failed to fetch schema"));
const jsonFile = JSON.stringify({ $schema: "http://t00n.de/404.json" });
await expect(validateJson(jsonFile)).rejects.toThrow(
"Failed to fetch schema"
"Failed to fetch schema",
);
});
@@ -61,15 +61,15 @@ describe("validateJson()", () => {
({
despiteThisBeingValidJson:
"toString() breaks it, making it invalid",
}.toString()),
}
}).toString(),
},
);
const jsonFile = JSON.stringify({
$schema: "https://json-schema.org/draft-07/schema",
});
await expect(validateJson(jsonFile)).rejects.toThrow(
'"[object Object]" is not valid JSON'
'"[object Object]" is not valid JSON',
);
});
@@ -79,7 +79,7 @@ describe("validateJson()", () => {
{
ok: true,
text: async () => validSchema,
}
},
);
const jsonFile = JSON.stringify({
@@ -87,7 +87,7 @@ describe("validateJson()", () => {
notTheExpectedField: 42,
});
await expect(validateJson(jsonFile)).rejects.toThrow(
"JSON file is not valid: No errors"
"JSON file is not valid: No errors",
);
});
@@ -97,7 +97,7 @@ describe("validateJson()", () => {
{
ok: true,
text: async () => validSchema,
}
},
);
const jsonFile = JSON.stringify({