Parcourir la source

:pencil2: Fixed semantic issues and addressed edge null case

tags/0.0.4
tomit4 il y a 2 ans
Parent
révision
19c92e2070

+ 1
- 1
backend/lib/routes/user/validate-session.js Voir le fichier

@@ -33,7 +33,7 @@ module.exports = {
33 33
                 const user = await userService.findByUserEmail(
34 34
                     validatedSessionToken.email,
35 35
                 )
36
-                const type = user.is_poster == 1 ? 'poster' : 'seeker'
36
+                const type = user.is_poster === 1 ? 'poster' : 'seeker'
37 37
                 const profiles = await profileService.getCompleteProfilesFor(
38 38
                     user.user_id,
39 39
                     type,

+ 1
- 1
backend/lib/services/profile/index.js Voir le fichier

@@ -45,7 +45,7 @@ module.exports = class ProfileService extends Schmervice.Service {
45 45
         /** Grab every Profile associated with this id */
46 46
         const allProfiles = await Profile.query().where('user_id', userId)
47 47
         /** Copy a list of the just the Profiles */
48
-        return typeof allProfiles === 'object'
48
+        return typeof allProfiles === 'object' && allProfiles !== null
49 49
             ? [...new Set(allProfiles.map(profile => profile.profile_id))]
50 50
             : [allProfiles]
51 51
     }

+ 1
- 1
backend/tests/user-create-profile.spec.js Voir le fichier

@@ -38,7 +38,7 @@ const pathToTest = {
38 38
     payload: JSON.stringify(payload),
39 39
 }
40 40
 
41
-test(`path /${params.user_id}/profile should return new profile info`, async t => {
41
+test('path /<user_id>/profile should return new profile info', async t => {
42 42
     /**
43 43
      * Create a new server and register services,
44 44
      * models and routes for testing

+ 1
- 1
backend/tests/user-verify-session.spec.js Voir le fichier

@@ -36,7 +36,7 @@ const pathToTest = {
36 36
     url: `/verify/${params.hashedSessionToken}`,
37 37
 }
38 38
 
39
-test(`path /verify/${params.hashedSessionToken} should return OK on GET`, async t => {
39
+test('path /verify/<hashedSessionToken> should return OK on GET', async t => {
40 40
     /**
41 41
      * Create a new server and register services,
42 42
      * models and routes for testing

Chargement…
Annuler
Enregistrer