|
|
@@ -1,15 +1,15 @@
|
|
|
-const { expect } = require('chai')
|
|
|
-const async = require('async')
|
|
|
-const User = require('./helpers/User')
|
|
|
-const redis = require('./helpers/redis')
|
|
|
-const UserSessionsRedis = require('../../../app/src/Features/User/UserSessionsRedis')
|
|
|
+import { expect } from 'chai'
|
|
|
+import async from 'async'
|
|
|
+import UserHelper from './helpers/User.js'
|
|
|
+import redis from './helpers/redis.mjs'
|
|
|
+import UserSessionsRedis from '../../../app/src/Features/User/UserSessionsRedis.js'
|
|
|
const rclient = UserSessionsRedis.client()
|
|
|
|
|
|
describe('Sessions', function () {
|
|
|
beforeEach(function (done) {
|
|
|
this.timeout(20000)
|
|
|
- this.user1 = new User()
|
|
|
- this.site_admin = new User({ email: 'admin@example.com' })
|
|
|
+ this.user1 = new UserHelper()
|
|
|
+ this.site_admin = new UserHelper({ email: 'admin@example.com' })
|
|
|
async.series(
|
|
|
[cb => this.user1.login(cb), cb => this.user1.logout(cb)],
|
|
|
done
|
|
|
@@ -73,7 +73,7 @@ describe('Sessions', function () {
|
|
|
describe('two sessions', function () {
|
|
|
beforeEach(function () {
|
|
|
// set up second session for this user
|
|
|
- this.user2 = new User()
|
|
|
+ this.user2 = new UserHelper()
|
|
|
this.user2.email = this.user1.email
|
|
|
this.user2.emails = this.user1.emails
|
|
|
this.user2.password = this.user1.password
|
|
|
@@ -198,11 +198,11 @@ describe('Sessions', function () {
|
|
|
describe('three sessions, password reset', function () {
|
|
|
beforeEach(function () {
|
|
|
// set up second session for this user
|
|
|
- this.user2 = new User()
|
|
|
+ this.user2 = new UserHelper()
|
|
|
this.user2.email = this.user1.email
|
|
|
this.user2.emails = this.user1.emails
|
|
|
this.user2.password = this.user1.password
|
|
|
- this.user3 = new User()
|
|
|
+ this.user3 = new UserHelper()
|
|
|
this.user3.email = this.user1.email
|
|
|
this.user3.emails = this.user1.emails
|
|
|
this.user3.password = this.user1.password
|
|
|
@@ -324,11 +324,11 @@ describe('Sessions', function () {
|
|
|
describe('three sessions, sessions page', function () {
|
|
|
beforeEach(function (done) {
|
|
|
// set up second session for this user
|
|
|
- this.user2 = new User()
|
|
|
+ this.user2 = new UserHelper()
|
|
|
this.user2.email = this.user1.email
|
|
|
this.user2.emails = this.user1.emails
|
|
|
this.user2.password = this.user1.password
|
|
|
- this.user3 = new User()
|
|
|
+ this.user3 = new UserHelper()
|
|
|
this.user3.email = this.user1.email
|
|
|
this.user3.emails = this.user1.emails
|
|
|
this.user3.password = this.user1.password
|
|
|
@@ -485,7 +485,7 @@ describe('Sessions', function () {
|
|
|
})
|
|
|
|
|
|
describe('validationToken', function () {
|
|
|
- const User = require('./helpers/User').promises
|
|
|
+ const User = UserHelper.promises
|
|
|
|
|
|
async function tryWithValidationToken(validationToken) {
|
|
|
const user = new User()
|