mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-13 22:37:29 +00:00
Parse JSON extension case-insensitively (#29)
Co-authored-by: Codex Microtask Operator <codex-microtask@example.com>
This commit is contained in:
parent
d9cf41e5a3
commit
3ceddaa911
2 changed files with 5 additions and 1 deletions
|
|
@ -14,6 +14,10 @@ describe("LogicSRC validators", () => {
|
|||
expect(validate("task", data).ok).toBe(true);
|
||||
});
|
||||
|
||||
it("parses JSON files case-insensitively by extension", () => {
|
||||
expect(parseDocument('{"ok":true}', "TASK.JSON")).toEqual({ ok: true });
|
||||
});
|
||||
|
||||
it("rejects a task without a DID", () => {
|
||||
const result = validate("task", {
|
||||
type: "logicsrc.task",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export function createValidator() {
|
|||
}
|
||||
|
||||
export function parseDocument(input: string, fileName = "document") {
|
||||
if (fileName.endsWith(".json")) {
|
||||
if (fileName.toLowerCase().endsWith(".json")) {
|
||||
return JSON.parse(input) as unknown;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue