Skip to content

Commit 55ee6f3

Browse files
committed
add test for casing
1 parent 781c26f commit 55ee6f3

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

test/specs/date-strings/date-strings.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ describe("Schema with date strings", () => {
2020
helper.testResolve(
2121
path.rel("test/specs/date-strings/date-strings.yaml"),
2222
path.abs("test/specs/date-strings/date-strings.yaml"),
23-
// @ts-expect-error TS(2554): Expected 2 arguments, but got 3.
2423
parsedSchema.schema,
2524
),
2625
);

test/specs/resolvers/resolvers.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, it } from "vitest";
22
import { expect } from "vitest";
3+
import type { FileInfo } from "../../../lib/index.js";
34
import $RefParser from "../../../lib/index.js";
45
import helper from "../../utils/helper.js";
56
import path from "../../utils/path.js";
@@ -227,4 +228,28 @@ describe("options.resolve", () => {
227228
]);
228229
}
229230
});
231+
232+
it("should preserver capitalization", async () => {
233+
const parser = new $RefParser();
234+
let parsed: string | undefined;
235+
await parser.dereference(
236+
{
237+
$ref: "custom://Path/Is/Case/Sensitive",
238+
},
239+
{
240+
resolve: {
241+
custom: {
242+
order: 1,
243+
canRead: /^custom:\/\//i,
244+
read(file: FileInfo, callback?: (error: Error | null, data: string | null) => any) {
245+
console.log(file.url);
246+
parsed = file.url;
247+
callback?.(null, "custom://Path/Is/Case/Sensitive");
248+
},
249+
},
250+
},
251+
} as ParserOptions,
252+
);
253+
expect(parsed).to.equal("custom://Path/Is/Case/Sensitive");
254+
});
230255
});

0 commit comments

Comments
 (0)