mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Merge remote-tracking branch 'upstream/master' into ELECTRON-249
# Conflicts: # js/mainApiMgr.js
This commit is contained in:
commit
cef30ff128
@ -16,6 +16,7 @@ const cmds = keyMirror({
|
|||||||
registerProtocolHandler: null,
|
registerProtocolHandler: null,
|
||||||
registerActivityDetection: null,
|
registerActivityDetection: null,
|
||||||
showNotificationSettings: null,
|
showNotificationSettings: null,
|
||||||
|
sanitize: null
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -14,6 +14,8 @@ const badgeCount = require('./badgeCount.js');
|
|||||||
const protocolHandler = require('./protocolHandler');
|
const protocolHandler = require('./protocolHandler');
|
||||||
const configureNotification = require('./notify/settings/configure-notification-position');
|
const configureNotification = require('./notify/settings/configure-notification-position');
|
||||||
const { bringToFront } = require('./bringToFront.js');
|
const { bringToFront } = require('./bringToFront.js');
|
||||||
|
const eventEmitter = require('./eventEmitter');
|
||||||
|
const { isMac } = require('./utils/misc');
|
||||||
|
|
||||||
const apiEnums = require('./enums/api.js');
|
const apiEnums = require('./enums/api.js');
|
||||||
const apiCmds = apiEnums.cmds;
|
const apiCmds = apiEnums.cmds;
|
||||||
@ -48,6 +50,24 @@ function isValidWindow(event) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that is invoked when the application is reloaded/navigated
|
||||||
|
* window.addEventListener('beforeunload')
|
||||||
|
* @param windowName
|
||||||
|
*/
|
||||||
|
function sanitize(windowName) {
|
||||||
|
// To make sure the reload event is from the main window
|
||||||
|
if (windowMgr.getMainWindow() && windowName === windowMgr.getMainWindow().winName) {
|
||||||
|
// reset the badge count whenever an user refreshes the electron client
|
||||||
|
badgeCount.show(0);
|
||||||
|
|
||||||
|
// Terminates the screen snippet process on reload
|
||||||
|
if (!isMac) {
|
||||||
|
eventEmitter.emit('killScreenSnippet');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle API related ipc messages from renderers. Only messages from windows
|
* Handle API related ipc messages from renderers. Only messages from windows
|
||||||
* we have created are allowed.
|
* we have created are allowed.
|
||||||
@ -61,54 +81,62 @@ electron.ipcMain.on(apiName, (event, arg) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg.cmd === apiCmds.isOnline && typeof arg.isOnline === 'boolean') {
|
switch(arg.cmd) {
|
||||||
|
case apiCmds.isOnline:
|
||||||
|
if (typeof arg.isOnline === 'boolean') {
|
||||||
windowMgr.setIsOnline(arg.isOnline);
|
windowMgr.setIsOnline(arg.isOnline);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
if (arg.cmd === apiCmds.setBadgeCount && typeof arg.count === 'number') {
|
case apiCmds.setBadgeCount:
|
||||||
|
if (typeof arg.count === 'number') {
|
||||||
badgeCount.show(arg.count);
|
badgeCount.show(arg.count);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
if (arg.cmd === apiCmds.registerProtocolHandler) {
|
case apiCmds.registerProtocolHandler:
|
||||||
protocolHandler.setProtocolWindow(event.sender);
|
protocolHandler.setProtocolWindow(event.sender);
|
||||||
protocolHandler.checkProtocolAction();
|
protocolHandler.checkProtocolAction();
|
||||||
}
|
break;
|
||||||
|
case apiCmds.badgeDataUrl:
|
||||||
if (arg.cmd === apiCmds.badgeDataUrl && typeof arg.dataUrl === 'string' &&
|
if (typeof arg.dataUrl === 'string' && typeof arg.count === 'number') {
|
||||||
typeof arg.count === 'number') {
|
|
||||||
badgeCount.setDataUrl(arg.dataUrl, arg.count);
|
badgeCount.setDataUrl(arg.dataUrl, arg.count);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
if (arg.cmd === apiCmds.activate && typeof arg.windowName === 'string') {
|
case apiCmds.activate:
|
||||||
|
if (typeof arg.windowName === 'string') {
|
||||||
// validates the user bring to front config and activates the wrapper
|
// validates the user bring to front config and activates the wrapper
|
||||||
if (typeof arg.reason === 'string' && arg.reason === 'bringToFront') {
|
if (typeof arg.reason === 'string' && arg.reason === 'bringToFront') {
|
||||||
bringToFront(arg.windowName);
|
bringToFront(arg.windowName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
windowMgr.activate(arg.windowName);
|
windowMgr.activate(arg.windowName);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
if (arg.cmd === apiCmds.registerBoundsChange) {
|
case apiCmds.registerBoundsChange:
|
||||||
windowMgr.setBoundsChangeWindow(event.sender);
|
windowMgr.setBoundsChangeWindow(event.sender);
|
||||||
}
|
break;
|
||||||
|
case apiCmds.registerLogger:
|
||||||
if (arg.cmd === apiCmds.registerLogger) {
|
|
||||||
// renderer window that has a registered logger from JS.
|
// renderer window that has a registered logger from JS.
|
||||||
log.setLogWindow(event.sender);
|
log.setLogWindow(event.sender);
|
||||||
}
|
break;
|
||||||
|
case apiCmds.registerActivityDetection:
|
||||||
if (arg.cmd === apiCmds.registerActivityDetection) {
|
if (typeof arg.period === 'number') {
|
||||||
// renderer window that has a registered activity detection from JS.
|
// renderer window that has a registered activity detection from JS.
|
||||||
activityDetection.setActivityWindow(arg.period, event.sender);
|
activityDetection.setActivityWindow(arg.period, event.sender);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
if (arg.cmd === apiCmds.showNotificationSettings && typeof arg.windowName === 'string') {
|
case apiCmds.showNotificationSettings:
|
||||||
|
if (typeof arg.windowName === 'string') {
|
||||||
configureNotification.openConfigurationWindow(arg.windowName);
|
configureNotification.openConfigurationWindow(arg.windowName);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case apiCmds.sanitize:
|
||||||
|
if (typeof arg.windowName === 'string') {
|
||||||
|
sanitize(arg.windowName);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// expose these methods primarily for testing...
|
// expose these methods primarily for testing...
|
||||||
|
@ -369,17 +369,17 @@ function createAPI() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset the badge count whenever an user refreshes the electron client
|
// Invoked whenever the app is reloaded/navigated
|
||||||
function resetBadgeCount() {
|
function sanitize() {
|
||||||
local.ipcRenderer.send(apiName, {
|
local.ipcRenderer.send(apiName, {
|
||||||
cmd: apiCmds.setBadgeCount,
|
cmd: apiCmds.sanitize,
|
||||||
count: 0
|
windowName: window.name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('offline', updateOnlineStatus, false);
|
window.addEventListener('offline', updateOnlineStatus, false);
|
||||||
window.addEventListener('online', updateOnlineStatus, false);
|
window.addEventListener('online', updateOnlineStatus, false);
|
||||||
window.addEventListener('beforeunload', resetBadgeCount, false);
|
window.addEventListener('beforeunload', sanitize, false);
|
||||||
|
|
||||||
updateOnlineStatus();
|
updateOnlineStatus();
|
||||||
}
|
}
|
@ -181,6 +181,14 @@ function createWarn(msg) {
|
|||||||
}
|
}
|
||||||
/* eslint-enable class-methods-use-this */
|
/* eslint-enable class-methods-use-this */
|
||||||
|
|
||||||
|
// terminates the screen snippet process wherever the
|
||||||
|
// main window is reloaded/navigated
|
||||||
|
eventEmitter.on('killScreenSnippet', function () {
|
||||||
|
if (child) {
|
||||||
|
child.kill();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
ScreenSnippet: ScreenSnippet,
|
ScreenSnippet: ScreenSnippet,
|
||||||
// note: readResult only exposed for testing purposes
|
// note: readResult only exposed for testing purposes
|
||||||
|
@ -52,6 +52,7 @@ const searchConfig = {
|
|||||||
MINIMUM_DATE: '0000000000000',
|
MINIMUM_DATE: '0000000000000',
|
||||||
MAXIMUM_DATE: '9999999999999',
|
MAXIMUM_DATE: '9999999999999',
|
||||||
SORT_BY_SCORE: 0,
|
SORT_BY_SCORE: 0,
|
||||||
|
INDEX_VERSION: 'v1',
|
||||||
BATCH_RANDOM_INDEX_PATH_LENGTH: 20,
|
BATCH_RANDOM_INDEX_PATH_LENGTH: 20,
|
||||||
LIBRARY_CONSTANTS: libraryPaths,
|
LIBRARY_CONSTANTS: libraryPaths,
|
||||||
FOLDERS_CONSTANTS: folderPaths,
|
FOLDERS_CONSTANTS: folderPaths,
|
||||||
|
@ -21,7 +21,11 @@ class SearchUtils {
|
|||||||
checkFreeSpace() {
|
checkFreeSpace() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!isMac) {
|
if (!isMac) {
|
||||||
|
try {
|
||||||
this.path = this.path.substring(0, 2);
|
this.path = this.path.substring(0, 2);
|
||||||
|
} catch (e) {
|
||||||
|
reject(new Error('Invalid Path : ' + e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
checkDiskSpace(this.path, resolve, reject);
|
checkDiskSpace(this.path, resolve, reject);
|
||||||
});
|
});
|
||||||
@ -65,7 +69,7 @@ function readFile(userId, resolve, reject) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return reject(new Error('Error reading the '))
|
return reject(new Error('Error reading the '))
|
||||||
}
|
}
|
||||||
let usersConfig = [];
|
let usersConfig = {};
|
||||||
try {
|
try {
|
||||||
usersConfig = JSON.parse(data);
|
usersConfig = JSON.parse(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -111,12 +115,16 @@ function createUser(userId, oldConfig) {
|
|||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
function createUserConfigFile(userId, data) {
|
function createUserConfigFile(userId, data) {
|
||||||
|
let userData = data;
|
||||||
|
|
||||||
let createStream = fs.createWriteStream(searchConfig.FOLDERS_CONSTANTS.USER_CONFIG_FILE);
|
let createStream = fs.createWriteStream(searchConfig.FOLDERS_CONSTANTS.USER_CONFIG_FILE);
|
||||||
if (data) {
|
if (userData) {
|
||||||
let jsonData;
|
if (!userData.indexVersion) {
|
||||||
|
userData.indexVersion = searchConfig.INDEX_VERSION;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
jsonData = JSON.stringify(data);
|
userData = JSON.stringify(userData);
|
||||||
createStream.write(`{"${userId}": ${jsonData}}`);
|
createStream.write(`{"${userId}": ${userData}}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
createStream.write(`{"${userId}": {}}`);
|
createStream.write(`{"${userId}": {}}`);
|
||||||
}
|
}
|
||||||
@ -135,9 +143,15 @@ function createUserConfigFile(userId, data) {
|
|||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
function updateConfig(userId, data, resolve, reject) {
|
function updateConfig(userId, data, resolve, reject) {
|
||||||
|
let userData = data;
|
||||||
|
|
||||||
|
if (userData && !userData.indexVersion) {
|
||||||
|
userData.indexVersion = searchConfig.INDEX_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
let configPath = searchConfig.FOLDERS_CONSTANTS.USER_CONFIG_FILE;
|
let configPath = searchConfig.FOLDERS_CONSTANTS.USER_CONFIG_FILE;
|
||||||
if (!fs.existsSync(configPath)) {
|
if (!fs.existsSync(configPath)) {
|
||||||
createUserConfigFile(userId, data);
|
createUserConfigFile(userId, userData);
|
||||||
return reject(null);
|
return reject(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const childProcess = require('child_process');
|
const childProcess = require('child_process');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const { isMac } = require('../js/utils/misc.js');
|
||||||
|
|
||||||
let executionPath = null;
|
let executionPath = null;
|
||||||
let userConfigDir = null;
|
let userConfigDir = null;
|
||||||
@ -45,6 +46,9 @@ describe('Tests for Search', function() {
|
|||||||
key = 'jjjehdnctsjyieoalskcjdhsnahsadndfnusdfsdfsd=';
|
key = 'jjjehdnctsjyieoalskcjdhsnahsadndfnusdfsdfsd=';
|
||||||
|
|
||||||
executionPath = path.join(__dirname, 'library');
|
executionPath = path.join(__dirname, 'library');
|
||||||
|
if (!isMac) {
|
||||||
|
executionPath = path.join(__dirname, '..', 'library');
|
||||||
|
}
|
||||||
userConfigDir = path.join(__dirname, '..');
|
userConfigDir = path.join(__dirname, '..');
|
||||||
|
|
||||||
searchConfig = require('../js/search/searchConfig.js');
|
searchConfig = require('../js/search/searchConfig.js');
|
||||||
@ -53,7 +57,7 @@ describe('Tests for Search', function() {
|
|||||||
|
|
||||||
realTimeIndexPath = path.join(userConfigDir, 'data', 'temp_realtime_index');
|
realTimeIndexPath = path.join(userConfigDir, 'data', 'temp_realtime_index');
|
||||||
tempBatchPath = path.join(userConfigDir, 'data', 'temp_batch_indexes');
|
tempBatchPath = path.join(userConfigDir, 'data', 'temp_batch_indexes');
|
||||||
dataFolderPath = path.join(searchConfig.FOLDERS_CONSTANTS.EXEC_PATH, '..', 'data');
|
dataFolderPath = path.join(userConfigDir, 'data');
|
||||||
if (fs.existsSync(dataFolderPath)) {
|
if (fs.existsSync(dataFolderPath)) {
|
||||||
fs.unlinkSync(dataFolderPath)
|
fs.unlinkSync(dataFolderPath)
|
||||||
}
|
}
|
||||||
@ -65,7 +69,7 @@ describe('Tests for Search', function() {
|
|||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
|
||||||
deleteIndexFolders(dataFolderPath);
|
deleteIndexFolders(dataFolderPath);
|
||||||
let root = path.join(searchConfig.FOLDERS_CONSTANTS.EXEC_PATH, '..', `${searchConfig.FOLDERS_CONSTANTS.PREFIX_NAME}_${userId}.enc`);
|
let root = path.join(userConfigDir, `${searchConfig.FOLDERS_CONSTANTS.PREFIX_NAME}_${userId}.enc`);
|
||||||
if (fs.existsSync(root)) {
|
if (fs.existsSync(root)) {
|
||||||
fs.unlinkSync(root);
|
fs.unlinkSync(root);
|
||||||
}
|
}
|
||||||
@ -77,7 +81,7 @@ describe('Tests for Search', function() {
|
|||||||
function deleteIndexFolders(location) {
|
function deleteIndexFolders(location) {
|
||||||
if (fs.existsSync(location)) {
|
if (fs.existsSync(location)) {
|
||||||
fs.readdirSync(location).forEach(function(file) {
|
fs.readdirSync(location).forEach(function(file) {
|
||||||
let curPath = location + "/" + file;
|
let curPath = path.join(location, file);
|
||||||
if (fs.lstatSync(curPath).isDirectory()) {
|
if (fs.lstatSync(curPath).isDirectory()) {
|
||||||
deleteIndexFolders(curPath);
|
deleteIndexFolders(curPath);
|
||||||
} else {
|
} else {
|
||||||
@ -421,11 +425,10 @@ describe('Tests for Search', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not get the latest timestamp', function (done) {
|
it('should not get the latest timestamp', function (done) {
|
||||||
SearchApi.indexFolderName = '';
|
|
||||||
const getLatestMessageTimestamp = jest.spyOn(SearchApi, 'getLatestMessageTimestamp');
|
const getLatestMessageTimestamp = jest.spyOn(SearchApi, 'getLatestMessageTimestamp');
|
||||||
|
deleteIndexFolders(dataFolderPath);
|
||||||
SearchApi.getLatestMessageTimestamp().catch(function (err) {
|
SearchApi.getLatestMessageTimestamp().catch(function (err) {
|
||||||
expect(err).toEqual(new Error('Index folder does not exist.'));
|
expect(err).toEqual(new Error('Index folder does not exist.'));
|
||||||
SearchApi.indexFolderName = `${dataFolderPath}/${searchConfig.FOLDERS_CONSTANTS.PREFIX_NAME}_${userId}`;
|
|
||||||
expect(getLatestMessageTimestamp).toHaveBeenCalled();
|
expect(getLatestMessageTimestamp).toHaveBeenCalled();
|
||||||
expect(getLatestMessageTimestamp).toHaveBeenCalledTimes(3);
|
expect(getLatestMessageTimestamp).toHaveBeenCalledTimes(3);
|
||||||
done();
|
done();
|
||||||
@ -435,11 +438,13 @@ describe('Tests for Search', function() {
|
|||||||
|
|
||||||
describe('Test to decrypt the index', function () {
|
describe('Test to decrypt the index', function () {
|
||||||
|
|
||||||
it('should decrypt the index', function () {
|
it('should decrypt the index', function (done) {
|
||||||
deleteIndexFolders(dataFolderPath);
|
setTimeout(function () {
|
||||||
const decryptAndInit = jest.spyOn(SearchApi, 'decryptAndInit');
|
const decryptAndInit = jest.spyOn(SearchApi, 'decryptAndInit');
|
||||||
SearchApi.decryptAndInit();
|
SearchApi.decryptAndInit();
|
||||||
expect(decryptAndInit).toHaveBeenCalled();
|
expect(decryptAndInit).toHaveBeenCalled();
|
||||||
|
done();
|
||||||
|
}, 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get message from the decrypted index', function (done) {
|
it('should get message from the decrypted index', function (done) {
|
||||||
@ -480,8 +485,9 @@ describe('Tests for Search', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should search fails index folder not fund', function (done) {
|
it('should search fails index folder not fund', function (done) {
|
||||||
const searchQuery = jest.spyOn(SearchApi, 'searchQuery');
|
|
||||||
deleteIndexFolders(dataFolderPath);
|
deleteIndexFolders(dataFolderPath);
|
||||||
|
setTimeout(function () {
|
||||||
|
const searchQuery = jest.spyOn(SearchApi, 'searchQuery');
|
||||||
SearchApi.searchQuery('it works', [], [], '', '', '', 25, 0, 0).catch(function (err) {
|
SearchApi.searchQuery('it works', [], [], '', '', '', 25, 0, 0).catch(function (err) {
|
||||||
expect(err).toEqual(new Error('Index folder does not exist.'));
|
expect(err).toEqual(new Error('Index folder does not exist.'));
|
||||||
expect(searchQuery).toHaveBeenCalledTimes(8);
|
expect(searchQuery).toHaveBeenCalledTimes(8);
|
||||||
@ -490,7 +496,8 @@ describe('Tests for Search', function() {
|
|||||||
const { Search } = require('../js/search/search.js');
|
const { Search } = require('../js/search/search.js');
|
||||||
SearchApi = new Search(userId, key);
|
SearchApi = new Search(userId, key);
|
||||||
done();
|
done();
|
||||||
});
|
})
|
||||||
|
}, 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search fails query is undefined', function (done) {
|
it('should search fails query is undefined', function (done) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const { isMac } = require('../js/utils/misc.js');
|
||||||
|
|
||||||
let executionPath = null;
|
let executionPath = null;
|
||||||
let userConfigDir = null;
|
let userConfigDir = null;
|
||||||
@ -60,20 +61,32 @@ describe('Tests for Search Utils', function() {
|
|||||||
|
|
||||||
it('should return error', function (done) {
|
it('should return error', function (done) {
|
||||||
const checkFreeSpace = jest.spyOn(SearchUtilsAPI, 'checkFreeSpace');
|
const checkFreeSpace = jest.spyOn(SearchUtilsAPI, 'checkFreeSpace');
|
||||||
|
if (isMac) {
|
||||||
SearchUtilsAPI.path = undefined;
|
SearchUtilsAPI.path = undefined;
|
||||||
SearchUtilsAPI.checkFreeSpace().catch(function (err) {
|
SearchUtilsAPI.checkFreeSpace().catch(function (err) {
|
||||||
expect(err).toEqual(new Error("Please provide path"));
|
expect(err).toEqual(new Error("Please provide path"));
|
||||||
expect(checkFreeSpace).toHaveBeenCalled();
|
expect(checkFreeSpace).toHaveBeenCalled();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
SearchUtilsAPI.path = undefined;
|
||||||
|
SearchUtilsAPI.checkFreeSpace().catch(function (err) {
|
||||||
|
expect(err).toBeTruthy();
|
||||||
|
expect(checkFreeSpace).toHaveBeenCalled();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return error invalid path', function (done) {
|
it('should return error invalid path', function (done) {
|
||||||
const checkFreeSpace = jest.spyOn(SearchUtilsAPI, 'checkFreeSpace');
|
const checkFreeSpace = jest.spyOn(SearchUtilsAPI, 'checkFreeSpace');
|
||||||
SearchUtilsAPI.path = './tp';
|
SearchUtilsAPI.path = './tp';
|
||||||
|
if (!isMac) {
|
||||||
|
SearchUtilsAPI.path = 'A://test';
|
||||||
|
}
|
||||||
SearchUtilsAPI.checkFreeSpace().catch(function (err) {
|
SearchUtilsAPI.checkFreeSpace().catch(function (err) {
|
||||||
expect(checkFreeSpace).toHaveBeenCalled();
|
expect(checkFreeSpace).toHaveBeenCalled();
|
||||||
expect(err).toEqual(err);
|
expect(err).toBeTruthy();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -111,6 +124,7 @@ describe('Tests for Search Utils', function() {
|
|||||||
language: 'en'
|
language: 'en'
|
||||||
};
|
};
|
||||||
SearchUtilsAPI.updateUserConfig(1234567891011, data).then(function (res) {
|
SearchUtilsAPI.updateUserConfig(1234567891011, data).then(function (res) {
|
||||||
|
data.indexVersion = 'v1';
|
||||||
expect(res).toEqual(data);
|
expect(res).toEqual(data);
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
@ -124,6 +138,7 @@ describe('Tests for Search Utils', function() {
|
|||||||
};
|
};
|
||||||
SearchUtilsAPI.updateUserConfig(1234567891011, data).then(function (res) {
|
SearchUtilsAPI.updateUserConfig(1234567891011, data).then(function (res) {
|
||||||
expect(res.rotationId).toEqual(1);
|
expect(res.rotationId).toEqual(1);
|
||||||
|
expect(res.indexVersion).toEqual('v1');
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user