Skip to content

Commit

Permalink
chore(withHandlers): add deprecation message
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed May 26, 2024
1 parent abb022b commit 9171e98
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/fromOpenApi/fromOpenApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SwaggerParser from '@apidevtools/swagger-parser'
import { normalizeSwaggerUrl } from './utils/normalizeSwaggerUrl.js'
import { getServers } from './utils/getServers.js'
import { isAbsoluteUrl, joinPaths } from './utils/url.js'
import { createResponseResolver, createResponseResolverFromContent } from './utils/openApiUtils.js'
import { createResponseResolver } from './utils/openApiUtils.js'

type SupportedHttpMethods = keyof typeof http
const supportedHttpMethods = Object.keys(
Expand Down Expand Up @@ -95,7 +95,6 @@ export async function fromOpenApi(

requestHandlers.push(handler)
}

}
}
}
Expand Down
3 changes: 3 additions & 0 deletions test/support/withHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { setupServer } from 'msw/node'
* Creates an MSW `server` instance, populates it
* with the given `handlers`, runs the `callback`,
* and cleans up afterward.
*
* @deprecated Remove this once all tests are migrated
* NOT to use this. Use `inspectHandlers` instead.
*/
export async function withHandlers<R>(
handlers: Array<RequestHandler>,
Expand Down
13 changes: 13 additions & 0 deletions vitest.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { Assertion, AsymmetricMatchersContaining } from 'vitest'

interface CustomMatchers<R = unknown> {
/**
* Compare two `Uint8Array` arrays.
*/
toEqualBytes: (expected: Uint8Array) => R
}

declare module 'vitest' {
interface Assertion<T = any> extends CustomMatchers<T> {}
interface AsymmetricMatchersContaining extends CustomMatchers {}
}

0 comments on commit 9171e98

Please sign in to comment.