|
2 | 2 | import { describe, expect, test } from 'bun:test' |
3 | 3 | import type { UrlMapValue } from '@devup-api/core' |
4 | 4 | import type { OpenAPIV3_1 } from 'openapi-types' |
5 | | -import { createUrlMap, getBodyType } from '../create-url-map' |
| 5 | +import { createUrlMap } from '../create-url-map' |
6 | 6 |
|
7 | 7 | test.each([ |
8 | 8 | [ |
@@ -605,95 +605,4 @@ describe('bodyType emission', () => { |
605 | 605 | }) |
606 | 606 | }) |
607 | 607 |
|
608 | | -describe('getBodyType', () => { |
609 | | - const emptyDoc: OpenAPIV3_1.Document = { |
610 | | - openapi: '3.1.0', |
611 | | - info: { title: 'Test', version: '1.0.0' }, |
612 | | - paths: {}, |
613 | | - } |
614 | | - |
615 | | - test('returns undefined when no requestBody', () => { |
616 | | - expect(getBodyType({ responses: {} }, emptyDoc)).toBeUndefined() |
617 | | - }) |
618 | | - |
619 | | - test('returns undefined for JSON content', () => { |
620 | | - expect( |
621 | | - getBodyType( |
622 | | - { |
623 | | - requestBody: { |
624 | | - content: { |
625 | | - 'application/json': { schema: { type: 'object' } }, |
626 | | - }, |
627 | | - }, |
628 | | - responses: {}, |
629 | | - }, |
630 | | - emptyDoc, |
631 | | - ), |
632 | | - ).toBeUndefined() |
633 | | - }) |
634 | | - |
635 | | - test('returns form for urlencoded content', () => { |
636 | | - expect( |
637 | | - getBodyType( |
638 | | - { |
639 | | - requestBody: { |
640 | | - content: { |
641 | | - 'application/x-www-form-urlencoded': { |
642 | | - schema: { type: 'object' }, |
643 | | - }, |
644 | | - }, |
645 | | - }, |
646 | | - responses: {}, |
647 | | - }, |
648 | | - emptyDoc, |
649 | | - ), |
650 | | - ).toBe('form') |
651 | | - }) |
652 | | - |
653 | | - test('returns multipart for multipart/form-data content', () => { |
654 | | - expect( |
655 | | - getBodyType( |
656 | | - { |
657 | | - requestBody: { |
658 | | - content: { |
659 | | - 'multipart/form-data': { schema: { type: 'object' } }, |
660 | | - }, |
661 | | - }, |
662 | | - responses: {}, |
663 | | - }, |
664 | | - emptyDoc, |
665 | | - ), |
666 | | - ).toBe('multipart') |
667 | | - }) |
668 | | - |
669 | | - test('returns undefined when requestBody has no content', () => { |
670 | | - expect( |
671 | | - getBodyType( |
672 | | - { |
673 | | - requestBody: { content: {} }, |
674 | | - responses: {}, |
675 | | - }, |
676 | | - emptyDoc, |
677 | | - ), |
678 | | - ).toBeUndefined() |
679 | | - }) |
680 | | - |
681 | | - test('prefers urlencoded over multipart when both present', () => { |
682 | | - expect( |
683 | | - getBodyType( |
684 | | - { |
685 | | - requestBody: { |
686 | | - content: { |
687 | | - 'application/x-www-form-urlencoded': { |
688 | | - schema: { type: 'object' }, |
689 | | - }, |
690 | | - 'multipart/form-data': { schema: { type: 'object' } }, |
691 | | - }, |
692 | | - }, |
693 | | - responses: {}, |
694 | | - }, |
695 | | - emptyDoc, |
696 | | - ), |
697 | | - ).toBe('form') |
698 | | - }) |
699 | | -}) |
| 608 | +// getBodyType is now internal (not exported) — tested indirectly through createUrlMap tests above |
0 commit comments