Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
8bff9b658d
|
@@ -31,7 +31,7 @@ describe("validateJson()", () => {
|
|||||||
despiteThisBeingValidJson: "toString() breaks it, making it invalid",
|
despiteThisBeingValidJson: "toString() breaks it, making it invalid",
|
||||||
}.toString();
|
}.toString();
|
||||||
await expect(validateJson(jsonFile)).rejects.toThrow(
|
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,
|
validJson: true,
|
||||||
});
|
});
|
||||||
await expect(validateJson(jsonFile)).rejects.toThrow(
|
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"));
|
vi.mocked(fetch).mockRejectedValue(new Error("Failed to fetch schema"));
|
||||||
const jsonFile = JSON.stringify({ $schema: "http://t00n.de/404.json" });
|
const jsonFile = JSON.stringify({ $schema: "http://t00n.de/404.json" });
|
||||||
await expect(validateJson(jsonFile)).rejects.toThrow(
|
await expect(validateJson(jsonFile)).rejects.toThrow(
|
||||||
"Failed to fetch schema"
|
"Failed to fetch schema",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -61,15 +61,15 @@ describe("validateJson()", () => {
|
|||||||
({
|
({
|
||||||
despiteThisBeingValidJson:
|
despiteThisBeingValidJson:
|
||||||
"toString() breaks it, making it invalid",
|
"toString() breaks it, making it invalid",
|
||||||
}.toString()),
|
}).toString(),
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const jsonFile = JSON.stringify({
|
const jsonFile = JSON.stringify({
|
||||||
$schema: "https://json-schema.org/draft-07/schema",
|
$schema: "https://json-schema.org/draft-07/schema",
|
||||||
});
|
});
|
||||||
await expect(validateJson(jsonFile)).rejects.toThrow(
|
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,
|
ok: true,
|
||||||
text: async () => validSchema,
|
text: async () => validSchema,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const jsonFile = JSON.stringify({
|
const jsonFile = JSON.stringify({
|
||||||
@@ -87,7 +87,7 @@ describe("validateJson()", () => {
|
|||||||
notTheExpectedField: 42,
|
notTheExpectedField: 42,
|
||||||
});
|
});
|
||||||
await expect(validateJson(jsonFile)).rejects.toThrow(
|
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,
|
ok: true,
|
||||||
text: async () => validSchema,
|
text: async () => validSchema,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const jsonFile = JSON.stringify({
|
const jsonFile = JSON.stringify({
|
||||||
|
|||||||
Reference in New Issue
Block a user