Skip to content

Commit 00b99ec

Browse files
author
Iurii Golovinskii
committed
review
1 parent f4ec74e commit 00b99ec

File tree

4 files changed

+15
-28
lines changed

4 files changed

+15
-28
lines changed

src/apitypes/rest/rest.changes.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ export const compareRestOperationsData = async (current: VersionRestOperation |
5959
normalizedResult: true,
6060
beforeSource: previous?.data,
6161
afterSource: current?.data,
62-
}
62+
},
6363
)
64-
console.log('Тутэн')
6564
const olnyBreaking = diffResult.diffs.filter((diff) => diff.type === breaking)
6665
if (olnyBreaking.length > 0 && previous?.operationId) {
6766
await reclassifyBreakingChanges(previous.operationId, diffResult.merged, olnyBreaking, ctx)
@@ -73,9 +72,8 @@ async function reclassifyBreakingChanges(
7372
operationId: string,
7473
mergedJso: unknown,
7574
diffs: Diff[],
76-
ctx: CompareOperationsPairContext
75+
ctx: CompareOperationsPairContext,
7776
): Promise<void> {
78-
console.log('Тутэн')
7977
if (!ctx.previousVersion || !ctx.previousPackageId) {
8078
return
8179
}
@@ -84,6 +82,7 @@ async function reclassifyBreakingChanges(
8482
return
8583
}
8684
previosVersionDeprecations.operations[0]
85+
8786
const previousOperation = previosVersionDeprecations.operations[0]
8887

8988
if (!previousOperation?.deprecatedItems) { return }
@@ -95,7 +94,6 @@ async function reclassifyBreakingChanges(
9594

9695
const deprecatedInVersionsCount = previousOperation?.deprecatedInPreviousVersions?.length ?? 0
9796
if (isOperationRemove(diff) && deprecatedInVersionsCount > 1) {
98-
console.log('Тутэн')
9997
diff.type = risky
10098
continue
10199
}
@@ -142,15 +140,11 @@ async function reclassifyBreakingChanges(
142140
diff.type = risky
143141
}
144142
}
145-
146-
147143
// mark removed required status of the property as risky
148144
if (diffs.length) {
149145
const requiredProperties = findRequiredRemovedProperties(mergedJso, diffs)
150-
//console.log('requiredProperties----->', requiredProperties)
151146

152147
requiredProperties?.forEach(prop => {
153-
// console.log('requiredProperties----->', prop.propDiff)
154148
if (prop.propDiff.type === RISKY_CHANGE_TYPE && prop.requiredDiff?.type === BREAKING_CHANGE_TYPE) {
155149
prop.requiredDiff.type = risky
156150
}

src/utils/transformToDto.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -194,23 +194,18 @@ export function replacePropertyInChangesSummary<
194194
origin: SEMI_BREAKING_CHANGE_TYPE,
195195
override: risky,
196196
}): ChangeSummary<J> {
197-
if (Object.prototype.hasOwnProperty.call(obj, origin)) {
198-
const copyObj= {...obj}
199-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
200-
// @ts-ignore
201-
copyObj[override] = copyObj[origin]
202-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
203-
// @ts-ignore
204-
delete copyObj[origin]
205-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
206-
// @ts-ignore
207-
return copyObj
208-
} else {
209-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
210-
// @ts-ignore
211-
return obj
212-
}
197+
{
198+
if (origin in obj) {
199+
const copyObj = { ...obj } as Record<PropertyKey, unknown>
200+
201+
copyObj[override] = copyObj[origin]
202+
delete copyObj[origin]
213203

204+
return copyObj as ChangeSummary<J>
205+
}
206+
207+
return obj as unknown as ChangeSummary<J>
208+
}
214209
}
215210

216211
export type DiffTypeCompare = DiffType | DiffTypeDto

test/deprecated.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ describe('Deprecated Items test', () => {
8989
}, {}, portal)
9090

9191
const result = await editor.run()
92-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
93-
// @ts-ignore
9492
expect(result.comparisons[0].operationTypes[0].changesSummary?.[RISKY_CHANGE_TYPE]).toBe(1)
9593
expect(result.comparisons[0].operationTypes[0].changesSummary?.[BREAKING_CHANGE_TYPE]).toBe(0)
9694
})

test/tests-v2/changelog.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ describe.skip('Change Log', () => {
882882
// expect(ar.notifications.length).toEqual(0)
883883
})
884884

885-
test.only('B-OA30-Y-CL-30.2 Adding oneOf', async () => {
885+
test('B-OA30-Y-CL-30.2 Adding oneOf', async () => {
886886
const version = 'v31.2'
887887
const er = await registry.getVersion(packageId, version)
888888

0 commit comments

Comments
 (0)