Skip to content

Commit 508971d

Browse files
committed
fix: resolve user export test failures
1 parent ef030e4 commit 508971d

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎src/user/jobs/export-posts.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ process.on('message', async (msg) => {
4545
interval: 1000,
4646
});
4747

48-
const fields = payload.length ? Object.keys(payload[0]) : [];
48+
const fields = payload.length ? Object.keys(payload[0]) : ['pid', 'content', 'timestamp', 'deleted', 'upvotes', 'downvotes'];
4949
const opts = { fields };
5050
const csv = await json2csvAsync(payload, opts);
5151
await fs.promises.writeFile(filePath, csv);

‎src/user/jobs/export-profile.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ process.on('message', async (msg) => {
5858
getSetData(`uid:${targetUid}:downvote`, 'post:', targetUid),
5959
getSetData(`following:${targetUid}`, 'user:', targetUid),
6060
]);
61-
delete userData.password;
61+
62+
if (userData) {
63+
delete userData.password;
64+
}
6265

6366
let chatData = [];
6467
await batch.processSortedSet(`uid:${targetUid}:chat:rooms`, async (roomIds) => {

‎test/controllers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ describe('Controllers', () => {
11111111
await Promise.all(types.map(async (type) => {
11121112
await api.users.generateExport({ uid: fooUid, ip: '127.0.0.1' }, { uid: fooUid, type });
11131113
}));
1114-
await sleep(10000);
1114+
await sleep(15000);
11151115
});
11161116

11171117
it('should export users posts', async () => {

0 commit comments

Comments
 (0)