mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-01-23 13:19:03 -05:00
* 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
27 lines
909 B
TypeScript
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(); |