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