Skip to content

Commit

Permalink
test: Add deprecated procedure opt test (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlalmes authored May 24, 2023
1 parent ca16875 commit d6de032
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2568,7 +2568,7 @@ describe('generator', () => {
(openApiDocument.paths['/with-all']!.post!.requestBody as any).content['application/json'],
).toEqual(
(openApiDocument.paths['/with-all']!.post!.requestBody as any).content[
'application/x-www-form-urlencoded'
'application/x-www-form-urlencoded'
],
);
expect(
Expand All @@ -2577,6 +2577,21 @@ describe('generator', () => {
}
});

test('with deprecated', () => {
const appRouter = t.router({
deprecated: t.procedure
.meta({ openapi: { method: 'POST', path: '/deprecated', deprecated: true } })
.input(z.object({ payload: z.string() }))
.output(z.object({ payload: z.string() }))
.mutation(({ input }) => ({ payload: input.payload })),
});

const openApiDocument = generateOpenApiDocument(appRouter, defaultDocOpts);

expect(openApiSchemaValidator.validate(openApiDocument).errors).toEqual([]);
expect(openApiDocument.paths['/deprecated']!.post!.deprecated).toEqual(true);
});

test('with security schemes', () => {
const appRouter = t.router({});

Expand Down

0 comments on commit d6de032

Please sign in to comment.