mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
test: fix tests
This commit is contained in:
@@ -1649,20 +1649,13 @@ describe('Controllers', () => {
|
||||
|
||||
describe('account follow page', () => {
|
||||
const socketUser = require('../src/socket.io/user');
|
||||
const apiUser = require('../src/api/users');
|
||||
let uid;
|
||||
before((done) => {
|
||||
user.create({ username: 'follower' }, (err, _uid) => {
|
||||
assert.ifError(err);
|
||||
uid = _uid;
|
||||
socketUser.follow({ uid: uid }, { uid: fooUid }, (err) => {
|
||||
assert.ifError(err);
|
||||
socketUser.isFollowing({ uid: uid }, { uid: fooUid }, (err, isFollowing) => {
|
||||
assert.ifError(err);
|
||||
before(async () => {
|
||||
uid = await user.create({ username: 'follower' });
|
||||
await apiUser.follow({ uid: uid }, { uid: fooUid });
|
||||
const isFollowing = await socketUser.isFollowing({ uid: uid }, { uid: fooUid });
|
||||
assert(isFollowing);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should get followers page', (done) => {
|
||||
@@ -1683,16 +1676,11 @@ describe('Controllers', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should return empty after unfollow', (done) => {
|
||||
socketUser.unfollow({ uid: uid }, { uid: fooUid }, (err) => {
|
||||
assert.ifError(err);
|
||||
request(`${nconf.get('url')}/api/user/foo/followers`, { json: true }, (err, res, body) => {
|
||||
assert.ifError(err);
|
||||
it('should return empty after unfollow', async () => {
|
||||
await apiUser.unfollow({ uid: uid }, { uid: fooUid });
|
||||
const { res, body } = await helpers.request('get', `/api/user/foo/followers`, { json: true });
|
||||
assert.equal(res.statusCode, 200);
|
||||
assert.equal(body.users.length, 0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user