Repository navigation
Expand file tree
/
Copy pathuser.js
More file actions
82 lines (74 loc) · 2.01 KB
/
Copy pathuser.js
File metadata and controls
82 lines (74 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var User = require('../../proxy/user');
var should = require('should');
var support = require('../support/support');
describe('proxy/user.js', function () {
describe('getUserByLoginName', function () {
it('should ok', function (done) {
User.getUserByLoginName('jacksontian', function (err, user) {
should.not.exist(err);
// TODO: check user
done();
});
});
});
describe('getUserByMail', function () {
it('should ok', function (done) {
User.getUserByMail('shyvo1987@gmail.com', function (err, user) {
should.not.exist(err);
// TODO: check user
done();
});
});
});
describe('getUsersByIds', function () {
var user;
before(function (done) {
support.createUser(function (err, user1) {
should.not.exist(err);
user = user1;
done();
});
});
it('should ok with empty list', function (done) {
User.getUsersByIds([], function (err, list) {
should.not.exist(err);
list.should.have.length(0);
done();
});
});
it('should ok', function (done) {
User.getUsersByIds([user._id], function (err, list) {
should.not.exist(err);
list.should.have.length(1);
var user1 = list[0];
user1.name.should.be.equal(user.name);
done();
});
});
});
describe('getUserByQuery', function () {
var user;
before(function (done) {
support.createUser(function (err, user1) {
should.not.exist(err);
user = user1;
done();
});
});
it('should not exist', function (done) {
User.getUserByQuery('name', 'key', function (err, user) {
should.not.exist(err);
should.not.exist(user);
done();
});
});
it('should exist', function (done) {
User.getUserByQuery(user.name, null, function (err, user1) {
should.not.exist(err);
should.exist(user1);
user1.name.should.be.equal(user.name);
done();
});
});
});
});