Skip to content

Commit 9443478

Browse files
committed
refactor: fix expected status in expect decorator
1 parent 0c6606d commit 9443478

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/services/expect-decorator/ExpectApiPackage.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@ export class ExpectApiPackage extends BaseExpect<PackageInput> {
2222
return new ExpectApiPackage(this.actual, !this.isNot, this.isSoft, this.message)
2323
}
2424

25-
protected override formatStepMessage(assertionDescription: string): string {
26-
return `Expect "${this.actual.name || this.actual.packageId}" package ${this.notIndicator}${assertionDescription}`
27-
}
28-
2925
async toBeCreated(): Promise<void> {
3026
await test.step(this.formatStepMessage('to be created'), async () => {
3127
const authData = await getAuthDataFromStorageStateFile(SS_SYSADMIN_PATH)
3228
const rest = await createRest(BASE_ORIGIN, authData.token)
3329
const response = await rest.send(rGetPackageById, [200, 404], this.actual)
34-
const expectedStatus = this.isNot ? 404 : 200
30+
const expectedStatus = 200
3531

3632
await this.executeExpectation(
3733
'to be created',
@@ -41,4 +37,8 @@ export class ExpectApiPackage extends BaseExpect<PackageInput> {
4137
)
4238
}, { box: true })
4339
}
40+
41+
protected override formatStepMessage(assertionDescription: string): string {
42+
return `API: Expect "${this.actual.name || this.actual.packageId}" package ${this.notIndicator}${assertionDescription}`
43+
}
4444
}

src/services/expect-decorator/ExpectApiVersion.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@ export class ExpectApiVersion extends BaseExpect<VersionInput> {
2222
return new ExpectApiVersion(this.actual, !this.isNot, this.isSoft, this.message)
2323
}
2424

25-
protected override formatStepMessage(assertionDescription: string): string {
26-
return `Expect version "${this.actual.version}" ${this.notIndicator}${assertionDescription}`
27-
}
28-
2925
async toBePublished(): Promise<void> {
3026
await test.step(this.formatStepMessage('to be created'), async () => {
3127
const authData = await getAuthDataFromStorageStateFile(SS_SYSADMIN_PATH)
3228
const rest = await createRest(BASE_ORIGIN, authData.token)
3329
const response = await rest.send(rGetPackageVersion, [200, 404], this.actual)
34-
const expectedStatus = this.isNot ? 404 : 200
30+
const expectedStatus = 200
3531

3632
await this.executeExpectation(
3733
'to be created',
@@ -41,4 +37,8 @@ export class ExpectApiVersion extends BaseExpect<VersionInput> {
4137
)
4238
}, { box: true })
4339
}
40+
41+
protected override formatStepMessage(assertionDescription: string): string {
42+
return `API: Expect version "${this.actual.version}" ${this.notIndicator}${assertionDescription}`
43+
}
4444
}

0 commit comments

Comments
 (0)