From f03ca0867b2d2c761b625e65d54350126490ba5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 23 Jun 2020 00:46:59 -0400 Subject: [PATCH] fix: tests --- public/openapi/read.yaml | 19 ++----------------- test/api.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/public/openapi/read.yaml b/public/openapi/read.yaml index c2861df591..11d072ed54 100644 --- a/public/openapi/read.yaml +++ b/public/openapi/read.yaml @@ -7636,29 +7636,14 @@ paths: items: type: object properties: - type: - type: string bodyShort: type: string - bodyLong: - type: string - pid: - oneOf: - - type: number - - type: string - tid: - type: number - description: A topic identifier path: type: string nid: type: string from: type: number - mergeId: - type: string - topicTitle: - type: string importance: type: number datetime: @@ -7677,6 +7662,7 @@ paths: removed, etc.) picture: type: string + nullable: true uid: type: number description: A user identifier @@ -7694,12 +7680,11 @@ paths: example: "#f44336" image: type: string + nullable: true read: type: boolean readClass: type: string - subject: - type: string filters: type: array items: diff --git a/test/api.js b/test/api.js index 92bdbe7358..435d0ab183 100644 --- a/test/api.js +++ b/test/api.js @@ -5,6 +5,8 @@ const path = require('path'); const SwaggerParser = require('@apidevtools/swagger-parser'); const request = require('request-promise-native'); const nconf = require('nconf'); +const util = require('util'); +const wait = util.promisify(setTimeout); const db = require('./mocks/databasemock'); const helpers = require('./helpers'); @@ -15,6 +17,7 @@ const topics = require('../src/topics'); const plugins = require('../src/plugins'); const flags = require('../src/flags'); const messaging = require('../src/messaging'); +const socketUser = require('../src/socket.io/user'); describe('Read API', async () => { let readApi = false; @@ -58,6 +61,13 @@ describe('Read API', async () => { // Create a new chat room await messaging.newRoom(1, [2]); + // export data for admin user + await socketUser.exportProfile({ uid: adminUid }, { uid: adminUid }); + await socketUser.exportPosts({ uid: adminUid }, { uid: adminUid }); + await socketUser.exportUploads({ uid: adminUid }, { uid: adminUid }); + // wait for export child process to complete + await wait(2000); + // Attach a search hook so /api/search is enabled plugins.registerHook('core', { hook: 'filter:search.query',