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

Laddar…
Avbryt
Spara