From 3de692cd522aa72f3cab9fbfd48285a737560917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 27 Nov 2020 16:07:52 -0500 Subject: [PATCH] fix: csv test --- test/controllers-admin.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/test/controllers-admin.js b/test/controllers-admin.js index 09691f4766..3befc0367c 100644 --- a/test/controllers-admin.js +++ b/test/controllers-admin.js @@ -264,16 +264,22 @@ describe('Admin Controllers', function () { }); it('should load /admin/users/csv', function (done) { - request(nconf.get('url') + '/api/admin/users/csv', { - jar: jar, - headers: { - referer: nconf.get('url') + '/admin/manage/users', - }, - }, function (err, res, body) { - assert.ifError(err); - assert.equal(res.statusCode, 200); - assert(body); - done(); + const socketAdmin = require('../src/socket.io/admin'); + socketAdmin.user.exportUsersCSV({ uid: adminUid }, {}, function (err) { + assert.ifError(err); + setTimeout(function () { + request(nconf.get('url') + '/api/admin/users/csv', { + jar: jar, + headers: { + referer: nconf.get('url') + '/admin/manage/users', + }, + }, function (err, res, body) { + assert.ifError(err); + assert.equal(res.statusCode, 200); + assert(body); + done(); + }); + }, 2000); }); });