File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,20 @@ import type { SchemaObject } from "@omer-x/openapi-types/schema";
55describe ( "createMediaType" , ( ) => {
66 const mockSchema : SchemaObject = { type : "string" } ;
77 const mockExample = "example text" ;
8+ const mockExamples = {
9+ "Example-1" : {
10+ value : "Example 1" ,
11+ description : "1st Example" ,
12+ } ,
13+ "Example-2" : {
14+ value : "Example 2" ,
15+ description : "2nd Example" ,
16+ } ,
17+ "Example-3" : {
18+ value : "Example 3" ,
19+ description : "3rd Example" ,
20+ } ,
21+ } ;
822
923 it ( "should create a MediaTypeObject with only the schema" , ( ) => {
1024 expect ( createMediaType ( mockSchema ) ) . toStrictEqual ( {
@@ -18,4 +32,24 @@ describe("createMediaType", () => {
1832 example : mockExample ,
1933 } ) ;
2034 } ) ;
35+
36+ it ( "should create a MediaTypeObject with schema and example when example is provided" , ( ) => {
37+ expect ( createMediaType ( mockSchema , undefined , mockExamples ) ) . toStrictEqual ( {
38+ schema : mockSchema ,
39+ examples : {
40+ "Example-1" : {
41+ value : "Example 1" ,
42+ description : "1st Example" ,
43+ } ,
44+ "Example-2" : {
45+ value : "Example 2" ,
46+ description : "2nd Example" ,
47+ } ,
48+ "Example-3" : {
49+ value : "Example 3" ,
50+ description : "3rd Example" ,
51+ } ,
52+ } ,
53+ } ) ;
54+ } ) ;
2155} ) ;
You can’t perform that action at this time.
0 commit comments