Skip to content

Commit

Permalink
front: fix missing await statements for asynchronous calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Maymanaf committed Dec 23, 2024
1 parent 63ef76e commit cdfb5a8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion front/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/non-nullable-type-assertion-style": "error",

"@typescript-eslint/ban-types": [
"error",
{
Expand Down Expand Up @@ -154,6 +153,12 @@
"rules": {
"@typescript-eslint/no-explicit-any": ["error", { "fixToUnknown": true }]
}
},
{
"files": ["tests/**/*.ts", "src/front/tests/**/*.tsx"],
"rules": {
"@typescript-eslint/no-floating-promises": "error"
}
}
]
}
2 changes: 1 addition & 1 deletion front/tests/004-scenario-management.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test.describe('Validate the Scenario creation workflow', () => {
});

test.afterAll('Delete the electrical profile', async () => {
deleteApiRequest(`/api/electrical_profile_set/${electricalProfileSet.id}/`);
await deleteApiRequest(`/api/electrical_profile_set/${electricalProfileSet.id}/`);
});

/** *************** Test 1 **************** */
Expand Down
2 changes: 1 addition & 1 deletion front/tests/pages/op-simulation-settings-page-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OperationalStudiesSimulationSettingsPage {
// Deactivate electrical profiles switch
async deactivateElectricalProfile() {
await this.electricalProfilesSwitch.setChecked(false, { force: true });
expect(this.electricalProfilesSwitch).not.toBeChecked();
await expect(this.electricalProfilesSwitch).not.toBeChecked();
}

async activateLinearMargin() {
Expand Down
2 changes: 1 addition & 1 deletion front/tests/pages/op-timetable-page-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class OperationalStudiesTimetablePage extends CommonPage {
// Verify that the imported train number is correct
async verifyTrainCount(trainCount: number): Promise<void> {
await this.page.waitForLoadState('networkidle');
expect(this.timetableTrains).toHaveCount(trainCount);
await expect(this.timetableTrains).toHaveCount(trainCount);
}

// Filter trains validity and verify their count
Expand Down
2 changes: 1 addition & 1 deletion front/tests/pages/operational-studies-page-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class OperationalStudiesPage extends CommonPage {
}

async checkTrainHasBeenAdded() {
this.checkLastToastTitle(trainAddedTranslation);
await this.checkLastToastTitle(trainAddedTranslation);
}

async returnSimulationResult() {
Expand Down

0 comments on commit cdfb5a8

Please sign in to comment.