Fix: Todo Multi refresh ...

fix some promises problem
This commit is contained in:
Paolo Arena
2019-02-14 19:01:41 +01:00
parent 0b4ac6391d
commit f6fa45a9e9
13 changed files with 191 additions and 121 deletions

View File

@@ -38,8 +38,9 @@ const users = [{
username: 'paoloar77B',
password: mypwdcrypted,
tokens: [{
access: 'auth ' + useragent,
token: jwt.sign({ _id: userOneId, access: 'auth ' + useragent }, process.env.SIGNCODE).toString(),
access: 'auth',
browser: useragent,
token: jwt.sign({ _id: userOneId, access: 'auth' }, process.env.SIGNCODE).toString(),
date_login
}]
},
@@ -52,8 +53,9 @@ const users = [{
password: mypwdcrypted,
username: 'paoloar77C',
tokens: [{
access: 'auth ' + useragent,
token: jwt.sign({ _id: userTwoId, access: 'auth ' + useragent }, process.env.SIGNCODE).toString(),
access: 'auth',
browser: useragent,
token: jwt.sign({ _id: userTwoId, access: 'auth' }, process.env.SIGNCODE).toString(),
date_login
}]
}, {

View File

@@ -36,7 +36,7 @@ const IndexTodoToCreate = 3;
// const useragent = "auth Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.96 Safari/537.36";
const useragent = "node-superagent/2.3.0";
const testsingolo = true;
const testsingolo = false;
if (testsingolo) {
describe('POST /users/login', () => {
@@ -63,7 +63,7 @@ if (testsingolo) {
User.findById(users[0]._id).then((user) => {
expect(user.tokens[0]).toInclude({
access: 'auth ' + useragent,
access: 'auth',
// token: res.headers['x-auth'],
date_login: date_login
});
@@ -160,7 +160,7 @@ if (testsingolo) {
User.findById(users[0]._id).then((user) => {
expect(user.tokens[0]).toInclude({
access: 'auth ' + useragent,
access: 'auth',
// token: res.headers['x-auth'],
date_login: date_login
});