Skip to content

Commit 7970aad

Browse files
committed
Refactor seed database user function to improve type consistency and add headline to user profile
1 parent 3e7fc0f commit 7970aad

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎tests/e2e/backend/utils/userInformation.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import {
33
CANNABIS_CHOICES,
44
DIET_CHOICES,
55
EDUCATION_CHOICES,
6+
LANGUAGE_CHOICES,
7+
MBTI_CHOICES,
68
POLITICAL_CHOICES,
79
PSYCHEDELICS_CHOICES,
810
RACE_CHOICES,
911
RELATIONSHIP_CHOICES,
1012
RELATIONSHIP_STATUS_CHOICES,
11-
ROMANTIC_CHOICES,
1213
RELIGION_CHOICES,
13-
LANGUAGE_CHOICES,
14+
ROMANTIC_CHOICES,
1415
SUBSTANCE_INTENTION_CHOICES,
1516
SUBSTANCE_PREFERENCE_CHOICES,
16-
MBTI_CHOICES,
1717
} from 'common/choices'
1818

1919
class UserAccountInformationForSeeding {
@@ -52,6 +52,7 @@ class UserAccountInformationForSeeding {
5252
occupation_title = faker.person.jobTitle()
5353
university = faker.company.name()
5454
keywords = faker.lorem.word()
55+
headline = faker.lorem.words({min: 8, max: 16})
5556

5657
cannabis = Object.values(CANNABIS_CHOICES)
5758
psychedelics = Object.values(PSYCHEDELICS_CHOICES)

‎tests/e2e/utils/seedDatabase.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {firebaseSignUp} from './firebaseUtils'
2020
export async function seedDbUser(
2121
userInfo: UserAccountInformationForSeeding,
2222
profileType?: string,
23-
): Promise<Boolean> {
23+
): Promise<boolean> {
2424
const pg = createSupabaseDirectClient()
2525
const userId = userInfo.user_id
2626
const deviceToken = randomString()
@@ -45,14 +45,14 @@ export async function seedDbUser(
4545
}
4646

4747
const numberOfLanguages = faker.number.int({min: 1, max: 3})
48-
let languagesKnown = []
48+
const languagesKnown = []
4949

5050
for (let i = 0; i < numberOfLanguages; i++) {
5151
languagesKnown.push(userInfo.randomElement(userInfo.languages))
5252
}
5353

5454
const keywords = faker.number.int({min: 1, max: 4})
55-
let profileKeywords = []
55+
const profileKeywords = []
5656
for (let i = 0; i < keywords; i++) {
5757
profileKeywords.push(userInfo.keywords)
5858
}
@@ -63,6 +63,8 @@ export async function seedDbUser(
6363
bio: bio,
6464
age: userInfo.age,
6565
gender: userInfo.randomElement(userInfo.gender),
66+
headline: userInfo.headline,
67+
keywords: profileKeywords,
6668
ethnicity: [userInfo.randomElement(userInfo.ethnicity)],
6769
height_in_inches: userInfo.height_in_inches,
6870
pref_gender: [userInfo.randomElement(userInfo.pref_gender)],
@@ -86,7 +88,6 @@ export async function seedDbUser(
8688
diet: [userInfo.randomElement(userInfo.diet)],
8789
education_level: userInfo.randomElement(userInfo.education_level),
8890
languages: languagesKnown,
89-
keywords: profileKeywords,
9091
}
9192

9293
const fullProfile = {

0 commit comments

Comments
 (0)