refactor: Use isSucceededNonTestRun naming for execution steps

This commit is contained in:
Faruk AYDIN
2024-10-09 15:41:27 +02:00
parent f6490990de
commit 4ce9976dbc
2 changed files with 12 additions and 11 deletions

View File

@@ -47,7 +47,7 @@ class ExecutionStep extends Base {
return this.status === 'failure'; return this.status === 'failure';
} }
async isNormalSucceededRun() { async isSucceededNonTestRun() {
const execution = await this.$relatedQuery('execution'); const execution = await this.$relatedQuery('execution');
return !execution.testRun && !this.isFailed; return !execution.testRun && !this.isFailed;
} }
@@ -63,7 +63,7 @@ class ExecutionStep extends Base {
} }
async increaseUsageCount() { async increaseUsageCount() {
if (appConfig.isCloud && this.isNormalSucceededRun()) { if (appConfig.isCloud && this.isSucceededNonTestRun()) {
await this.updateUsageData(); await this.updateUsageData();
} }
} }

View File

@@ -61,7 +61,7 @@ describe('ExecutionStep model', () => {
}); });
}); });
describe('isNormalSuccededRun', () => { describe('isSucceededNonTestRun', () => {
it('should return false if it has a test run execution', async () => { it('should return false if it has a test run execution', async () => {
const execution = await createExecution({ const execution = await createExecution({
testRun: true, testRun: true,
@@ -71,7 +71,7 @@ describe('ExecutionStep model', () => {
executionId: execution.id, executionId: execution.id,
}); });
expect(await executionStep.isNormalSucceededRun()).toBe(false); expect(await executionStep.isSucceededNonTestRun()).toBe(false);
}); });
it('should return false if it has a failure status', async () => { it('should return false if it has a failure status', async () => {
@@ -79,15 +79,15 @@ describe('ExecutionStep model', () => {
status: 'failure', status: 'failure',
}); });
expect(await executionStep.isNormalSucceededRun()).toBe(false); expect(await executionStep.isSucceededNonTestRun()).toBe(false);
}); });
it('should return true if it has a succeeded normal execution', async () => { it('should return true if it has a succeeded non test run', async () => {
const executionStep = await createExecutionStep({ const executionStep = await createExecutionStep({
status: 'success', status: 'success',
}); });
expect(await executionStep.isNormalSucceededRun()).toBe(true); expect(await executionStep.isSucceededNonTestRun()).toBe(true);
}); });
}); });
@@ -107,11 +107,12 @@ describe('ExecutionStep model', () => {
}); });
describe('increaseUsageCount', () => { describe('increaseUsageCount', () => {
it('should call updateUsageData for cloud and normal succeeded run', async () => { it('should call updateUsageData for cloud and succeeded non test run', async () => {
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true); vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true);
vi.spyOn(ExecutionStep.prototype, 'isNormalSucceededRun').mockReturnValue( vi.spyOn(
true ExecutionStep.prototype,
); 'isSucceededNonTestRun'
).mockReturnValue(true);
const executionStep = await createExecutionStep(); const executionStep = await createExecutionStep();