Skip to content

Commit 0ac9f35

Browse files
committed
chore(tests): skip url safety resolver in browser
1 parent 5ffea78 commit 0ac9f35

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/specs/resolvers/resolvers.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,16 @@ describe("options.resolve", () => {
256256
it("should block unsafe URLs when safeUrlResolver is true (default)", async () => {
257257
const unsafeUrls = [
258258
"http://localhost/schema.json",
259-
"http://127.0.0.1/schema.json",
259+
"http://127.0.0.1/schema.json",
260260
"http://192.168.1.1/schema.json",
261261
"http://10.0.0.1/schema.json",
262262
"http://172.16.0.1/schema.json",
263263
];
264264

265+
// if we're in the browser, skip the test
266+
if (typeof window !== "undefined") {
267+
return;
268+
}
265269
for (const unsafeUrl of unsafeUrls) {
266270
try {
267271
await $RefParser.dereference({ $ref: unsafeUrl });
@@ -283,14 +287,11 @@ describe("options.resolve", () => {
283287
},
284288
};
285289

286-
const schema = await $RefParser.dereference(
287-
{ $ref: "http://localhost/schema.json" },
288-
{
289-
resolve: {
290-
http: mockHttpResolver,
291-
},
292-
} as ParserOptions,
293-
);
290+
const schema = await $RefParser.dereference({ $ref: "http://localhost/schema.json" }, {
291+
resolve: {
292+
http: mockHttpResolver,
293+
},
294+
} as ParserOptions);
294295

295296
expect(schema).to.deep.equal({
296297
type: "object",

0 commit comments

Comments
 (0)