File tree Expand file tree Collapse file tree 5 files changed +100
-0
lines changed
different-hashes-for-each-operation
different-hashes-for-each-pathitems-operation Expand file tree Collapse file tree 5 files changed +100
-0
lines changed Original file line number Diff line number Diff line change 1+ import { loadFileAsString , LocalRegistry , VERSIONS_PATH } from './helpers'
2+ import { PACKAGE } from '../src'
3+
4+ const GROUP_NAME = 'manualGroup'
5+
6+ const groupToOnePathOperationIdsMap = {
7+ [ GROUP_NAME ] : [
8+ 'path1-get' ,
9+ 'path1-post' ,
10+ ] ,
11+ }
12+
13+ describe ( 'Hash test' , ( ) => {
14+ describe ( 'Document group hash' , ( ) => {
15+ async function publishAndGetHash ( packagePath : string ) : Promise < void > {
16+ const pkg = LocalRegistry . openPackage ( packagePath , groupToOnePathOperationIdsMap )
17+ await pkg . publish ( pkg . packageId , { packageId : pkg . packageId } )
18+
19+ const operationFile = await loadFileAsString (
20+ VERSIONS_PATH ,
21+ `${ pkg . packageId } /v1` ,
22+ `${ PACKAGE . OPERATIONS_DIR_NAME } .json` ,
23+ )
24+ expect ( operationFile ) . not . toBeNull ( )
25+
26+ const operationData = JSON . parse ( operationFile ! )
27+
28+ expect ( operationData . operations . length ) . toBe ( 2 )
29+ expect ( operationData . operations [ 0 ] ) . not . toEqual ( operationData . operations [ 1 ] )
30+ }
31+
32+ test ( 'should be different hashes for each operation' , async ( ) => {
33+ await publishAndGetHash ( 'hash/different-hashes-for-each-operation' )
34+ } )
35+
36+ test ( 'should be different hashes for each pathitems operation' , async ( ) => {
37+ await publishAndGetHash ( 'hash/different-hashes-for-each-pathitems-operation' )
38+ } )
39+ } )
40+ } )
Original file line number Diff line number Diff line change 1+ openapi : " 3.1.0"
2+ info :
3+ title : test
4+ version : 0.1.0
5+ paths :
6+ /path1 :
7+ get :
8+ responses :
9+ ' 200 ' :
10+ description : response description main
11+ post :
12+ responses :
13+ ' 200 ' :
14+ description : response description main
15+
16+
Original file line number Diff line number Diff line change 1+ {
2+ "packageId" : " 55" ,
3+ "apiType" : " rest" ,
4+ "version" : " v1" ,
5+ "files" : [
6+ {
7+ "fileId" : " 1.yaml" ,
8+ "publish" : true ,
9+ "labels" : [],
10+ "commitId" : " 6c778b1f44200bd19944a6a8eac10a4e5a21a3cd"
11+ }
12+ ]
13+ }
Original file line number Diff line number Diff line change 1+ openapi : " 3.1.0"
2+ info :
3+ title : test
4+ version : 0.1.0
5+ paths :
6+ /path1 :
7+ $ref : ' #/components/pathItems/pathItem1'
8+ components :
9+ pathItems :
10+ pathItem1 :
11+ get :
12+ responses :
13+ ' 200 ' :
14+ description : response description main
15+ post :
16+ responses :
17+ ' 200 ' :
18+ description : response description main
Original file line number Diff line number Diff line change 1+ {
2+ "packageId" : " 55" ,
3+ "apiType" : " rest" ,
4+ "version" : " v1" ,
5+ "files" : [
6+ {
7+ "fileId" : " 1.yaml" ,
8+ "publish" : true ,
9+ "labels" : [],
10+ "commitId" : " 6c778b1f44200bd19944a6a8eac10a4e5a21a3cd"
11+ }
12+ ]
13+ }
You can’t perform that action at this time.
0 commit comments