-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into remove_browser_field_type
- Loading branch information
Showing
9 changed files
with
170 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/kbn-openapi-bundler/tests/bundler/result_overrides/sort_tags.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { bundleSpecs } from '../bundle_specs'; | ||
import { createOASDocument } from '../../create_oas_document'; | ||
|
||
describe('OpenAPI Bundler - sort tags', () => { | ||
it('sorts tags in the result bundle', async () => { | ||
const spec1 = createOASDocument({ | ||
paths: { | ||
'/api/some_api': { | ||
get: { | ||
responses: {}, | ||
}, | ||
}, | ||
}, | ||
tags: [ | ||
{ name: 'Some tag name', description: 'Some description' }, | ||
{ name: '1 tag', description: 'Some description' }, | ||
], | ||
}); | ||
const spec2 = createOASDocument({ | ||
paths: { | ||
'/api/some_api': { | ||
post: { | ||
responses: {}, | ||
}, | ||
}, | ||
}, | ||
tags: [{ name: 'Another tag name', description: 'Another description' }], | ||
}); | ||
const spec3 = createOASDocument({ | ||
paths: { | ||
'/api/some_api': { | ||
put: { | ||
responses: {}, | ||
}, | ||
}, | ||
}, | ||
tags: [{ name: 'Spec3 tag name', description: 'Spec3 tag description' }], | ||
}); | ||
|
||
const [bundledSpec] = Object.values( | ||
await bundleSpecs({ | ||
1: spec1, | ||
2: spec2, | ||
3: spec3, | ||
}) | ||
); | ||
|
||
expect(bundledSpec.tags).toEqual([ | ||
{ name: '1 tag', description: 'Some description' }, | ||
{ name: 'Another tag name', description: 'Another description' }, | ||
{ name: 'Some tag name', description: 'Some description' }, | ||
{ name: 'Spec3 tag name', description: 'Spec3 tag description' }, | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/kbn-openapi-bundler/tests/merger/result_overrides/sort_tags.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { mergeSpecs } from '../merge_specs'; | ||
import { createOASDocument } from '../../create_oas_document'; | ||
|
||
describe('OpenAPI Merger - sort tags', () => { | ||
it('sorts tags in the result bundle', async () => { | ||
const spec1 = createOASDocument({ | ||
paths: { | ||
'/api/some_api': { | ||
get: { | ||
responses: {}, | ||
}, | ||
}, | ||
}, | ||
tags: [ | ||
{ name: 'Some tag name', description: 'Some description' }, | ||
{ name: '1 tag', description: 'Some description' }, | ||
], | ||
}); | ||
const spec2 = createOASDocument({ | ||
paths: { | ||
'/api/some_api': { | ||
post: { | ||
responses: {}, | ||
}, | ||
}, | ||
}, | ||
tags: [{ name: 'Another tag name', description: 'Another description' }], | ||
}); | ||
const spec3 = createOASDocument({ | ||
paths: { | ||
'/api/some_api': { | ||
put: { | ||
responses: {}, | ||
}, | ||
}, | ||
}, | ||
tags: [{ name: 'Spec3 tag name', description: 'Spec3 tag description' }], | ||
}); | ||
|
||
const [mergedSpec] = Object.values( | ||
await mergeSpecs({ | ||
1: spec1, | ||
2: spec2, | ||
3: spec3, | ||
}) | ||
); | ||
|
||
expect(mergedSpec.tags).toEqual([ | ||
{ name: '1 tag', description: 'Some description' }, | ||
{ name: 'Another tag name', description: 'Another description' }, | ||
{ name: 'Some tag name', description: 'Some description' }, | ||
{ name: 'Spec3 tag name', description: 'Spec3 tag description' }, | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters