fix: WebPush Notification
This commit is contained in:
@@ -36,28 +36,41 @@ 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 = false;
|
||||
const testsingolo = true;
|
||||
|
||||
if (testsingolo) {
|
||||
it('should create a new Todos', (done) => {
|
||||
request(app)
|
||||
.post('/todos')
|
||||
.set('x-auth', users[0].tokens[0].token)
|
||||
.send(todos[IndexTodoToCreate])
|
||||
.expect(200)
|
||||
.end((err, res) => {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
describe('POST /users/login', () => {
|
||||
it('should login user and return auth token', (done) => {
|
||||
request(app)
|
||||
.post('/users/login')
|
||||
// .set('x-auth', users[0].tokens[0].token)
|
||||
.send({
|
||||
username: users[0].username,
|
||||
password: mypwdchiaro,
|
||||
idapp: users[0].idapp,
|
||||
keyappid: users[0].keyappid,
|
||||
lang: users[0].lang,
|
||||
subs: null,
|
||||
})
|
||||
.expect(200)
|
||||
.expect((res) => {
|
||||
expect(res.headers['x-auth']).toExist();
|
||||
})
|
||||
.end((err, res) => {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
Todo.find({ descr: todos[IndexTodoToCreate].descr }).then((arr_todos) => {
|
||||
expect(arr_todos.length).toBe(1);
|
||||
expect(arr_todos[0].descr).toBe(todos[IndexTodoToCreate].descr);
|
||||
expect(String(arr_todos[0]._id)).toBe(String(todos[IndexTodoToCreate]._id));
|
||||
expect(String(arr_todos[0].userId)).toBe(String(users[0]._id));
|
||||
done();
|
||||
}).catch((e) => done(e));
|
||||
});
|
||||
User.findById(users[0]._id).then((user) => {
|
||||
expect(user.tokens[0]).toInclude({
|
||||
access: 'auth ' + useragent,
|
||||
// token: res.headers['x-auth'],
|
||||
date_login: date_login
|
||||
});
|
||||
done();
|
||||
}).catch((e) => done(e));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user