Bläddra i källkod

:pencil2: Cleaned up a bit of user-send-email test

tags/0.0.4
tomit4 2 år sedan
förälder
incheckning
f6debb75db
1 ändrade filer med 6 tillägg och 13 borttagningar
  1. 6
    13
      backend/tests/user-send-email.spec.js

+ 6
- 13
backend/tests/user-send-email.spec.js Visa fil

@@ -2,10 +2,12 @@
2 2
 
3 3
 /*
4 4
  * NOTE: This test ACTUALLY will send an email
5
- * (see email variable below)
6
- * USE WITH CAUTION
5
+ * (see commented out email variable below)
7 6
  */
8 7
 
8
+// Change email here to your actual email
9
+// const email = 'myalias@myactualemail.com'
10
+
9 11
 const test = require('ava')
10 12
 const { stub } = require('sinon')
11 13
 const Hapi = require('@hapi/hapi')
@@ -13,7 +15,6 @@ const UserService = require('../lib/services/user.js')
13 15
 const plugin = require('../lib/plugins/user.js')
14 16
 
15 17
 // Necessary Dependencies/Configurations for Brevo Transac Email
16
-require('dotenv').config()
17 18
 const crypto = require('crypto')
18 19
 const SibApiV3Sdk = require('sib-api-v3-sdk')
19 20
 const defaultClient = SibApiV3Sdk.ApiClient.instance
@@ -21,9 +22,6 @@ const apiKey = defaultClient.authentications['api-key']
21 22
 apiKey.apiKey = process.env.BREVO_KEY
22 23
 const apiInstance = new SibApiV3Sdk.TransactionalEmailsApi()
23 24
 
24
-// Change email here to your actual email
25
-const email = 'myalias@myactualemail.com'
26
-
27 25
 // Existing activeSession to test against (should not match)
28 26
 const activeSessions = {
29 27
     'a;lsdkfja;ldfjka;ldfja;lskjdfa;dfjk': {
@@ -39,13 +37,6 @@ const activeSessions = {
39 37
 
40 38
 let hashedSessionToken = ''
41 39
 
42
-const userCredentials = {
43
-    email: email,
44
-    name: 'fk',
45
-    seeking: 'seeker',
46
-    sessionToken: 'a;slkdjfa;lskdf;asjkdfl;asdf;klj',
47
-}
48
-
49 40
 const payload = {
50 41
     email: email,
51 42
     name: 'fk',
@@ -53,6 +44,8 @@ const payload = {
53 44
     sessionToken: 'a;slkdjfa;lskdf;asjkdfl;asdf;klj',
54 45
 }
55 46
 
47
+const userCredentials = payload
48
+
56 49
 const pathToTest = {
57 50
     method: 'POST',
58 51
     url: '/send-email/',

Laddar…
Avbryt
Spara