Files
Compass/tests/e2e/backend/utils/database.ts
Okechi Jones-Williams 6b11e6b060 Add minor changes to tests (#20)
* setting up test structure

* .

* added playwright config file, deleted original playwright folder and moved "some.test" file

* continued test structure setup

* Updating test folder structure

* Added database seeding script and backend testing folder structure

* removed the database test

* Replaced db seeding script

* Updated userInformation.ts to use values from choices.tsx

* merge prep

* removing extra unit test, moving api test to correct folder
2025-11-15 15:35:45 +01:00

27 lines
909 B
TypeScript

class DatabaseTestingUtilities {
findUserByName = async (page: any, name: string) => {
const queryUserById = `
SELECT p.*
FROM public.users AS p
WHERE name = $1
`;
const userResults = await page.db.query(queryUserById,[name])
return userResults[0]
}
findProfileById = async (page: any, user_id: string) => {
const queryProfileById = `
SELECT
p.*,
TO_CHAR(p.created_time, 'Mon DD, YYYY HH12:MI AM') as created_date,
TO_CHAR(p.last_modification_time, 'Mon DD, YYYY HH12:MI AM') as modified_date
FROM public.profiles AS p
WHERE user_id = $1
`;
const profileResults = await page.db.query(queryProfileById,[user_id])
return profileResults[0]
}
}
export const databaseUtils = new DatabaseTestingUtilities();