From 7970aadf7ca60f6e56fed50ede6f7f8871603adf Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sat, 23 May 2026 19:53:56 +0200 Subject: [PATCH] Refactor seed database user function to improve type consistency and add headline to user profile --- tests/e2e/backend/utils/userInformation.ts | 7 ++++--- tests/e2e/utils/seedDatabase.ts | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/e2e/backend/utils/userInformation.ts b/tests/e2e/backend/utils/userInformation.ts index 10e687b2..9e1d39fe 100644 --- a/tests/e2e/backend/utils/userInformation.ts +++ b/tests/e2e/backend/utils/userInformation.ts @@ -3,17 +3,17 @@ import { CANNABIS_CHOICES, DIET_CHOICES, EDUCATION_CHOICES, + LANGUAGE_CHOICES, + MBTI_CHOICES, POLITICAL_CHOICES, PSYCHEDELICS_CHOICES, RACE_CHOICES, RELATIONSHIP_CHOICES, RELATIONSHIP_STATUS_CHOICES, - ROMANTIC_CHOICES, RELIGION_CHOICES, - LANGUAGE_CHOICES, + ROMANTIC_CHOICES, SUBSTANCE_INTENTION_CHOICES, SUBSTANCE_PREFERENCE_CHOICES, - MBTI_CHOICES, } from 'common/choices' class UserAccountInformationForSeeding { @@ -52,6 +52,7 @@ class UserAccountInformationForSeeding { occupation_title = faker.person.jobTitle() university = faker.company.name() keywords = faker.lorem.word() + headline = faker.lorem.words({min: 8, max: 16}) cannabis = Object.values(CANNABIS_CHOICES) psychedelics = Object.values(PSYCHEDELICS_CHOICES) diff --git a/tests/e2e/utils/seedDatabase.ts b/tests/e2e/utils/seedDatabase.ts index 035b3b34..ab826ded 100644 --- a/tests/e2e/utils/seedDatabase.ts +++ b/tests/e2e/utils/seedDatabase.ts @@ -20,7 +20,7 @@ import {firebaseSignUp} from './firebaseUtils' export async function seedDbUser( userInfo: UserAccountInformationForSeeding, profileType?: string, -): Promise { +): Promise { const pg = createSupabaseDirectClient() const userId = userInfo.user_id const deviceToken = randomString() @@ -45,14 +45,14 @@ export async function seedDbUser( } const numberOfLanguages = faker.number.int({min: 1, max: 3}) - let languagesKnown = [] + const languagesKnown = [] for (let i = 0; i < numberOfLanguages; i++) { languagesKnown.push(userInfo.randomElement(userInfo.languages)) } const keywords = faker.number.int({min: 1, max: 4}) - let profileKeywords = [] + const profileKeywords = [] for (let i = 0; i < keywords; i++) { profileKeywords.push(userInfo.keywords) } @@ -63,6 +63,8 @@ export async function seedDbUser( bio: bio, age: userInfo.age, gender: userInfo.randomElement(userInfo.gender), + headline: userInfo.headline, + keywords: profileKeywords, ethnicity: [userInfo.randomElement(userInfo.ethnicity)], height_in_inches: userInfo.height_in_inches, pref_gender: [userInfo.randomElement(userInfo.pref_gender)], @@ -86,7 +88,6 @@ export async function seedDbUser( diet: [userInfo.randomElement(userInfo.diet)], education_level: userInfo.randomElement(userInfo.education_level), languages: languagesKnown, - keywords: profileKeywords, } const fullProfile = {