Skip to content

Commit

Permalink
coderabit suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
JaiPannu-IITI committed Feb 16, 2025
1 parent 1909d58 commit 6fdc408
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/utilities/testDbConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ async function checkCountAfterImport(): Promise<boolean> {
return allValid;
} catch (error) {
console.error(`ERROR: ${error}`);
return false;
}
return false;
}

Check warning on line 66 in src/utilities/testDbConnection.ts

View check run for this annotation

Codecov / codecov/patch

src/utilities/testDbConnection.ts#L61-L66

Added lines #L61 - L66 were not covered by tests

/**
Expand All @@ -81,17 +81,15 @@ async function updateDatabase(): Promise<boolean> {

const userId = user[0]?.id;

Check warning on line 82 in src/utilities/testDbConnection.ts

View check run for this annotation

Codecov / codecov/patch

src/utilities/testDbConnection.ts#L82

Added line #L82 was not covered by tests

await db
// Update the user and return the updated row
const [updatedUser] = await db
.update(schema.usersTable)
.set({ name: updatedName })
.where(sql`id = ${userId}`);

const updatedUser = await db
.select()
.from(schema.usersTable)
.where(sql`id = ${userId}`);
.where(sql`id = ${userId}`)
.returning({ name: schema.usersTable.name });

Check warning on line 89 in src/utilities/testDbConnection.ts

View check run for this annotation

Codecov / codecov/patch

src/utilities/testDbConnection.ts#L85-L89

Added lines #L85 - L89 were not covered by tests

if (updatedUser[0]?.name !== updatedName) {
// Validate update in one step
if (!updatedUser || updatedUser.name !== updatedName) {
console.error("ERROR: Database update failed!");
return false;
}
Expand Down

0 comments on commit 6fdc408

Please sign in to comment.