Skip to content

Commit

Permalink
chore: undo structuredClone of fastify options
Browse files Browse the repository at this point in the history
  • Loading branch information
seriousme committed Nov 1, 2024
1 parent 86f7419 commit 3950700
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions test/test-cookie-param.v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test("route registration succeeds with cookie param", (t, done) => {
serviceHandlers,
};

const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
fastify.register(fastifyOpenapiGlue, opts);
fastify.ready((err) => {
if (err) {
Expand All @@ -43,7 +43,7 @@ test("route registration inserts cookie schema", (t, done) => {
addCookieSchema: true,
};

const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
// Register onRoute handler which will be called when the plugin registers routes in the specification.
let hadCookieSchema = false;
fastify.addHook("onRoute", (routeOptions) => {
Expand Down
8 changes: 4 additions & 4 deletions test/test-petstore-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Fastify from "fastify";
import petstoreExample, { options } from "../examples/petstore/index.js";

test("/v2/pet/24 works", async (t) => {
const fastify = Fastify(structuredClone(options));
const fastify = Fastify(options);
fastify.register(petstoreExample, {});
const res = await fastify.inject({
method: "GET",
Expand All @@ -23,7 +23,7 @@ test("/v2/pet/24 works", async (t) => {
});

test("/v2/pet/myPet returns Fastify validation error", async (t) => {
const fastify = Fastify(structuredClone(options));
const fastify = Fastify(options);
fastify.register(petstoreExample, {});
const res = await fastify.inject({
method: "GET",
Expand All @@ -37,7 +37,7 @@ test("/v2/pet/myPet returns Fastify validation error", async (t) => {
});

test("v2/pet/findByStatus?status=available&status=pending returns 'not implemented'", async (t) => {
const fastify = Fastify(structuredClone(options));
const fastify = Fastify(options);
fastify.register(petstoreExample, {});
const res = await fastify.inject({
method: "GET",
Expand All @@ -54,7 +54,7 @@ test("v2/pet/findByStatus?status=available&status=pending returns 'not implement
});

test("v2/pet/0 returns serialization error", async (t) => {
const fastify = Fastify(structuredClone(options));
const fastify = Fastify(options);
fastify.register(petstoreExample, {});
const res = await fastify.inject({
method: "GET",
Expand Down
4 changes: 2 additions & 2 deletions test/test-plugin.v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ test("invalid service definition throws error ", (t, done) => {
});

test("full pet store V2 definition does not throw error ", (t, done) => {
const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
fastify.register(fastifyOpenapiGlue, {
specification: structuredClone(petStoreSpec),
serviceHandlers,
Expand Down Expand Up @@ -292,7 +292,7 @@ test("generic path parameters override works", async (t) => {
});

test("schema attributes for non-body parameters work", async (t) => {
const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
fastify.register(fastifyOpenapiGlue, {
specification: structuredClone(petStoreSpec),
serviceHandlers,
Expand Down
10 changes: 5 additions & 5 deletions test/test-plugin.v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ test("response schema works with invalid response", async (t) => {
});

test("yaml spec works", async (t) => {
const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
fastify.register(fastifyOpenapiGlue, yamlOpts);

const res = await fastify.inject({
Expand Down Expand Up @@ -315,7 +315,7 @@ test("missing service definition throws error ", (t, done) => {
});

test("full pet store V3 definition does not throw error ", (t, done) => {
const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
// dummy parser to fix coverage testing
fastify.addContentTypeParser(
"application/xml",
Expand All @@ -341,7 +341,7 @@ test("V3.0.1 definition does not throw error", (t, done) => {
serviceHandlers,
};

const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
fastify.register(fastifyOpenapiGlue, opts301);
fastify.ready((err) => {
if (err) {
Expand All @@ -361,7 +361,7 @@ test("V3.0.2 definition does not throw error", (t, done) => {
serviceHandlers,
};

const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
fastify.register(fastifyOpenapiGlue, opts302);
fastify.ready((err) => {
if (err) {
Expand All @@ -381,7 +381,7 @@ test("V3.0.3 definition does not throw error", (t, done) => {
serviceHandlers,
};

const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
fastify.register(fastifyOpenapiGlue, opts303);
fastify.ready((err) => {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion test/test-recursive.v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test("route registration succeeds with recursion", (t, done) => {
serviceHandlers,
};

const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
fastify.register(fastifyOpenapiGlue, opts);
fastify.ready((err) => {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion test/test-securityHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function doTest(version, testSpecName, petStoreSpecName, prefix) {
securityHandlers,
};

const fastify = Fastify(structuredClone(noStrict));
const fastify = Fastify(noStrict);
fastify.register(fastifyOpenapiGlue, opts);
fastify.ready((err) => {
if (err) {
Expand Down

0 comments on commit 3950700

Please sign in to comment.