Update all Python and JS dependencies. Fixes #4019

This commit is contained in:
Khushboo Vashi
2019-03-14 15:11:16 +00:00
committed by Dave Page
parent c7b29d35ae
commit e4417229aa
133 changed files with 8649 additions and 8569 deletions

View File

@@ -12,52 +12,50 @@ import gettext from 'sources/gettext';
describe('alertify_wrapper', function () {
describe('success', function () {
var env = jasmine.getEnv();
env.allowRespy(true);
describe('alertify_success', function () {
it('calls the success function from alertify and adds the checkmark to the element', function () {
spyOn(alertify, 'orig_success');
let spyObj = spyOn(alertify, 'orig_success').and.callThrough();
alertify.success('Yay, congrats!', 1);
var calledWithMessage = alertify.orig_success.calls.mostRecent().args[0];
expect(calledWithMessage).toContain('Yay, congrats!');
expect(calledWithMessage).toContain('class="fa fa-check text-success"');
expect(spyObj).toHaveBeenCalled();
expect(spyObj.calls.mostRecent().args[0]).toContain('Yay, congrats!');
expect(spyObj.calls.mostRecent().args[0]).toContain('class="fa fa-check text-success"');
});
});
describe('error', function () {
it('calls the error function from alertify and adds the warning symbol to the element', function () {
spyOn(alertify, 'orig_error');
describe('alertify_error calls the error function', function() {
it('and adds the warning symbol to the element', function () {
let spyOrigError = spyOn(alertify, 'orig_error').and.callThrough();
alertify.error('bad, very bad', 1);
var calledWithMessage = alertify.orig_error.calls.mostRecent().args[0];
expect(calledWithMessage).toContain('bad, very bad');
expect(calledWithMessage).toContain('class="fa fa-exclamation-triangle text-danger"');
expect(spyOrigError).toHaveBeenCalled();
expect(spyOrigError.calls.mostRecent().args[0]).toContain('bad, very bad');
expect(spyOrigError.calls.mostRecent().args[0]).toContain('class="fa fa-exclamation-triangle text-danger"');
});
});
describe('pgRespErrorNotify', () => {
it('calls error notifier which alertifies response error for ajax calls', () => {
describe('alertify_error calls pgRespErrorNotify notifier', function() {
it('which alertifies response error for ajax calls', () => {
$.ajax({
url: 'http://some/dummy/url',
dataType: 'json',
error: function(xhr, status, error) {
spyOn(alertify, 'orig_error').and.callThrough();
spyOn(alertify, 'notify').and.callThrough();
let spyOrigError = spyOn(alertify, 'orig_error').and.callThrough(),
spyNotify = spyOn(alertify, 'notify').and.callThrough();
/*When connection lost*/
xhr.status = 0;
alertify.pgRespErrorNotify(xhr, error);
expect(alertify.orig_error).toHaveBeenCalled();
expect(alertify.orig_error.calls.mostRecent().args[0]).toContain(
expect(spyOrigError).toHaveBeenCalled();
expect(spyOrigError.calls.mostRecent().args[0]).toContain(
gettext('Connection to the server has been lost.')
);
/*When some exception occurs at back end*/
xhr.status = 4;
var orig_getResponseHeader = xhr.getResponseHeader;
@@ -70,12 +68,11 @@ describe('alertify_wrapper', function () {
else {
return orig_getResponseHeader(header);
}
};
xhr.responseText = '{"errormsg":"Exception XYZ"}';
alertify.pgRespErrorNotify(xhr, error);
expect(alertify.orig_error).toHaveBeenCalled();
expect(alertify.orig_error.calls.mostRecent().args[0]).toContain(
expect(spyOrigError).toHaveBeenCalled();
expect(spyOrigError.calls.mostRecent().args[0]).toContain(
gettext('Exception XYZ')
);
@@ -90,8 +87,8 @@ describe('alertify_wrapper', function () {
};
xhr.responseText = '<p>Some Exception Occurred</p>';
alertify.pgRespErrorNotify(xhr, error);
expect(alertify.notify).toHaveBeenCalled();
expect(alertify.notify.calls.mostRecent().args[0]).toContain(
expect(spyNotify).toHaveBeenCalled();
expect(spyNotify.calls.mostRecent().args[0]).toContain(
gettext('INTERNAL SERVER ERROR')
);
@@ -106,8 +103,8 @@ describe('alertify_wrapper', function () {
};
xhr.responseText = '{"errormsg":"Exception XYZ"}';
alertify.pgRespErrorNotify(xhr, error, gettext('Some prefix message'));
expect(alertify.orig_error).toHaveBeenCalled();
expect(alertify.orig_error.calls.mostRecent().args[0]).toContain(
expect(spyOrigError).toHaveBeenCalled();
expect(spyOrigError.calls.mostRecent().args[0]).toContain(
gettext('Some prefix message')
);
},

View File

@@ -58,7 +58,7 @@ define([
it('keyboard shortcut control should be rendered with inner fields', function () {
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('I');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('I');
expect(control.$el.find('input:checkbox[name="alt_option"]')[0].checked).toBeTruthy();
@@ -78,7 +78,7 @@ define([
it('when model "key" value changes UI and innerModel should update new "key" value', function (done) {
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('I');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('I');
expect(control.innerModel.get('key')).toEqual({
'key_code': 73,
'char': 'I',
@@ -98,7 +98,7 @@ define([
// wait until UI updates.
setTimeout(function() {
// this should change
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('A');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('A');
expect(control.innerModel.get('key')).toEqual({
'key_code': 65,
'char': 'A',
@@ -142,7 +142,7 @@ define([
expect(control.$el.find('input:checkbox[name="alt_option"]')[0].checked).toBeTruthy();
expect(control.innerModel.get('alt_option')).toBeTruthy();
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('I');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('I');
expect(control.innerModel.get('key')).toEqual({
'key_code': 73,
'char': 'I',
@@ -179,7 +179,7 @@ define([
expect(control.$el.find('input:checkbox[name="alt_option"]')[0].checked).toBeTruthy();
expect(control.innerModel.get('alt_option')).toBeTruthy();
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('I');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('I');
expect(control.innerModel.get('key')).toEqual({
'key_code': 73,
'char': 'I',
@@ -216,7 +216,7 @@ define([
expect(control.$el.find('input:checkbox[name="shift"]')[0].checked).toBeFalsy();
expect(control.innerModel.get('shift')).toBeFalsy();
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('I');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('I');
expect(control.innerModel.get('key')).toEqual({
'key_code': 73,
'char': 'I',
@@ -241,7 +241,7 @@ define([
it('when innerModel "key" value changes UI and model should update new "key" value', function (done) {
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('I');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('I');
expect(model.get(field.get('name'))).toEqual({
'control': true,
'shift': false,
@@ -262,7 +262,7 @@ define([
// wait until UI updates.
setTimeout(function() {
// this should change
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('A');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('A');
expect(model.get(field.get('name'))).toEqual({
'control': true,
'shift': false,
@@ -317,7 +317,7 @@ define([
// below three should not change.
expect(control.$el.find('input:checkbox[name="alt_option"]')[0].checked).toBeTruthy();
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('I');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('I');
expect(control.$el.find('input:checkbox[name="shift"]')[0].checked).toBeFalsy();
@@ -358,7 +358,7 @@ define([
// below three should not change.
expect(control.$el.find('input:checkbox[name="alt_option"]')[0].checked).toBeTruthy();
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('I');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('I');
expect(control.$el.find('input:checkbox[name="control"]')[0].checked).toBeTruthy();
@@ -399,7 +399,7 @@ define([
// below three should not change.
expect(control.$el.find('input:checkbox[name="shift"]')[0].checked).toBeFalsy();
expect(control.$el.find('input:text[name="key"]')[0].value).toBe('I');
expect(control.$el.find('input:text[name="key"]')[0].value).toEqual('I');
expect(control.$el.find('input:checkbox[name="control"]')[0].checked).toBeTruthy();
@@ -424,7 +424,7 @@ define([
expect(control.cleanup).toHaveBeenCalled();
expect(control.controls.length).toBe(0);
expect(control.controls.length).toEqual(0);
});

View File

@@ -75,7 +75,7 @@ define([
// wait until UI updates.
setTimeout(function() {
expect(control.$el.find('input')[0].value).toBe('A');
expect(control.$el.find('input')[0].value).toEqual('A');
done();
}, 100);
@@ -101,7 +101,7 @@ define([
// wait until UI updates.
setTimeout(function() {
expect(control.$el.find('input')[0].value).toBe('B');
expect(control.$el.find('input')[0].value).toEqual('B');
done();
}, 100);
@@ -139,7 +139,7 @@ define([
// wait until UI updates.
setTimeout(function() {
expect(control.$el.find('input')[0].value).toBe('A');
expect(control.$el.find('input')[0].value).toEqual('A');
done();
}, 100);
@@ -162,7 +162,7 @@ define([
// wait until UI updates.
setTimeout(function() {
expect(control.$el.find('input')[0].value).toBe('A');
expect(control.$el.find('input')[0].value).toEqual('A');
done();
}, 100);
@@ -178,7 +178,7 @@ define([
it('when model changes UI should update', function (done) {
expect(control.$el.find('input')[0].value).toBe('A');
expect(control.$el.find('input')[0].value).toEqual('A');
model.set('key', {
'key_code': 67,
@@ -187,7 +187,7 @@ define([
// wait until UI updates.
setTimeout(function() {
expect(control.$el.find('input')[0].value).toBe('C');
expect(control.$el.find('input')[0].value).toEqual('C');
done();
}, 100);
@@ -196,4 +196,4 @@ define([
});
});
});
});

View File

@@ -96,12 +96,12 @@ describe('BackupDialogWrapper', () => {
return backupNodeChildNodeSpy;
}
});
alertifySpy = jasmine.createSpyObj('alertify', ['alert', 'dialog']);
});
describe('#prepare', () => {
beforeEach(() => {
alertifySpy = jasmine.createSpyObj('alertify', ['alert', 'dialog']);
backupDialogWrapper = new BackupDialogWrapper(
'<div class=\'backup_dialog\'></div>',
'backupDialogTitle',
@@ -385,11 +385,11 @@ describe('BackupDialogWrapper', () => {
beforeEach(() => {
pgBrowser.Events = jasmine.createSpyObj('Events', ['trigger']);
alertifySpy.success = jasmine.createSpy('success');
networkMock.onPost('/backup/job/10').reply((request) => {
dataSentToServer = request.data;
return [200, {'success': 1}];
});
});
it('creates a success alert box', (done) => {
@@ -436,7 +436,7 @@ describe('BackupDialogWrapper', () => {
});
backupDialogWrapper.callback(event);
setTimeout(() => {
setTimeout( () => {
expect(alertifySpy.alert).toHaveBeenCalledWith(
'Backup job failed.',
'some-error-message'
@@ -550,7 +550,7 @@ describe('BackupDialogWrapper', () => {
});
});
describe('#setExtraParameters', () => {
xdescribe('#setExtraParameters', () => {
let selectedTreeNode;
let treeInfo;
let model;

View File

@@ -16,19 +16,19 @@ describe('backup.menuUtils', () => {
describe('#menuEnabledServer', () => {
context('provided node data is undefined', () => {
it('returns false', () => {
expect(menuEnabledServer(undefined)).toBe(false);
expect(menuEnabledServer(undefined)).toEqual(false);
});
});
context('provided node data is null', () => {
it('returns false', () => {
expect(menuEnabledServer(null)).toBe(false);
expect(menuEnabledServer(null)).toEqual(false);
});
});
context('current node type is not of the type server', () => {
it('returns false', () => {
expect(menuEnabledServer({_type: 'schema'})).toBe(false);
expect(menuEnabledServer({_type: 'schema'})).toEqual(false);
});
});
@@ -38,7 +38,7 @@ describe('backup.menuUtils', () => {
expect(menuEnabledServer({
_type: 'server',
connected: true,
})).toBe(true);
})).toEqual(true);
});
});
context('is not connected', () => {
@@ -46,7 +46,7 @@ describe('backup.menuUtils', () => {
expect(menuEnabledServer({
_type: 'server',
connected: false,
})).toBe(false);
})).toEqual(false);
});
});
});

View File

@@ -139,7 +139,7 @@ describe('preferences related functions test', function() {
expect($.fn.css).toHaveBeenCalledWith('font-size', '1.46em');
let setOptionCalls = pgBrowser.editor.setOption.calls;
expect(setOptionCalls.count()).toBe(Object.keys(editorOptions).length);
expect(setOptionCalls.count()).toEqual(Object.keys(editorOptions).length);
for(let i = 0; i < Object.keys(editorOptions).length; i++) {
let option = Object.keys(editorOptions)[i];

View File

@@ -36,7 +36,7 @@ describe('when external tables is loaded', () => {
});
it('returns the not updated version of pgBrowser', () => {
expect(result).toBe(pgBrowser);
expect(result).toEqual(pgBrowser);
});
});

View File

@@ -16,7 +16,7 @@ describe('#show_advanced_tab', () => {
it('should return true', () => {
tableModel = {};
expect(show_advanced_tab(tableModel)).toBe(true);
expect(show_advanced_tab(tableModel)).toEqual(true);
});
});
@@ -27,7 +27,7 @@ describe('#show_advanced_tab', () => {
node_info: {},
};
expect(show_advanced_tab(tableModel)).toBe(true);
expect(show_advanced_tab(tableModel)).toEqual(true);
});
});
@@ -42,7 +42,7 @@ describe('#show_advanced_tab', () => {
},
};
expect(show_advanced_tab(tableModel)).toBe(false);
expect(show_advanced_tab(tableModel)).toEqual(false);
});
});
@@ -56,7 +56,7 @@ describe('#show_advanced_tab', () => {
},
};
expect(show_advanced_tab(tableModel)).toBe(true);
expect(show_advanced_tab(tableModel)).toEqual(true);
});
});
});

View File

@@ -58,7 +58,7 @@ describe('Server#ModelValidation', () => {
describe('Service id present', () => {
it('sets empty service name which should throw an error', () => {
model.allValues['service'] = '';
expect(modelValidation.validate()).toBe('Either Host name, Address or Service must be specified.');
expect(modelValidation.validate()).toEqual('Either Host name, Address or Service must be specified.');
expect(model.errorModel.set).toHaveBeenCalledWith({
host: 'Either Host name, Address or Service must be specified.',
hostaddr: 'Either Host name, Address or Service must be specified.',
@@ -81,7 +81,7 @@ describe('Server#ModelValidation', () => {
it('sets the "SSH Tunnel host must be specified." error', () => {
model.allValues['tunnel_port'] = 22;
model.allValues['tunnel_username'] = 'user1';
expect(modelValidation.validate()).toBe('SSH Tunnel host must be specified.');
expect(modelValidation.validate()).toEqual('SSH Tunnel host must be specified.');
expect(model.errorModel.set).toHaveBeenCalledWith({
tunnel_host:'SSH Tunnel host must be specified.',
});
@@ -89,7 +89,7 @@ describe('Server#ModelValidation', () => {
it('sets the "SSH Tunnel port must be specified." error', () => {
model.allValues['tunnel_host'] = 'host';
model.allValues['tunnel_username'] = 'user1';
expect(modelValidation.validate()).toBe('SSH Tunnel port must be specified.');
expect(modelValidation.validate()).toEqual('SSH Tunnel port must be specified.');
expect(model.errorModel.set).toHaveBeenCalledWith({
tunnel_port:'SSH Tunnel port must be specified.',
});
@@ -97,7 +97,7 @@ describe('Server#ModelValidation', () => {
it('sets the "SSH Tunnel username be specified." error', () => {
model.allValues['tunnel_host'] = 'host';
model.allValues['tunnel_port'] = 22;
expect(modelValidation.validate()).toBe('SSH Tunnel username must be specified.');
expect(modelValidation.validate()).toEqual('SSH Tunnel username must be specified.');
expect(model.errorModel.set).toHaveBeenCalledWith({
tunnel_username:'SSH Tunnel username must be specified.',
});
@@ -107,7 +107,7 @@ describe('Server#ModelValidation', () => {
model.allValues['tunnel_port'] = 22;
model.allValues['tunnel_username'] = 'user1';
model.allValues['tunnel_authentication'] = 1;
expect(modelValidation.validate()).toBe('SSH Tunnel identity file must be specified.');
expect(modelValidation.validate()).toEqual('SSH Tunnel identity file must be specified.');
expect(model.errorModel.set).toHaveBeenCalledWith({
tunnel_identity_file:'SSH Tunnel identity file must be specified.',
});
@@ -118,7 +118,7 @@ describe('Server#ModelValidation', () => {
describe('When no parameters are valid', () => {
describe('Service id not present', () => {
it('does not set any error in the model', () => {
expect(modelValidation.validate()).toBe('Name must be specified.');
expect(modelValidation.validate()).toEqual('Name must be specified.');
expect(model.errorModel.set).toHaveBeenCalledTimes(1);
expect(model.errorModel.set).toHaveBeenCalledWith({
name: 'Name must be specified.',
@@ -134,7 +134,7 @@ describe('Server#ModelValidation', () => {
describe('Host address is not valid', () => {
it('sets the "Host address must be a valid IPv4 or IPv6 address" error', () => {
model.allValues['hostaddr'] = 'something that is not an ip address';
expect(modelValidation.validate()).toBe('Host address must be valid IPv4 or IPv6 address.');
expect(modelValidation.validate()).toEqual('Host address must be valid IPv4 or IPv6 address.');
expect(model.errorModel.set).toHaveBeenCalledTimes(1);
expect(model.errorModel.set).toHaveBeenCalledWith({
name: 'Name must be specified.',
@@ -149,7 +149,7 @@ describe('Server#ModelValidation', () => {
describe('Service id present', () => {
it('does not set any error in the model', () => {
model.allValues['service'] = 'asdfg';
expect(modelValidation.validate()).toBe('Name must be specified.');
expect(modelValidation.validate()).toEqual('Name must be specified.');
expect(model.errorModel.set).toHaveBeenCalledTimes(1);
expect(model.errorModel.set).toHaveBeenCalledWith({
name: 'Name must be specified.',

View File

@@ -8,25 +8,25 @@
//////////////////////////////////////////////////////////////////////////
define(['sources/check_node_visibility'],
function (checkNodeVisibility) {
describe('checkNodeVisibility', function () {
function (checkNodeVisibility) {
describe('checkNodeVisibility', function () {
var browser;
var browser;
browser = jasmine.createSpyObj('browser', [
'node_preference_data', 'get_preference']
);
browser = jasmine.createSpyObj('browser', [
'node_preference_data', 'get_preference']
);
describe('when node is server collection', function () {
it('returns true', function () {
expect(checkNodeVisibility(browser, 'coll-server')).toEqual(true);
describe('when node is server collection', function () {
it('returns true', function () {
expect(checkNodeVisibility(browser, 'coll-server')).toEqual(true);
});
});
});
describe('when node is server', function () {
it('returns true', function () {
expect(checkNodeVisibility(browser, 'server')).toEqual(true);
describe('when node is server', function () {
it('returns true', function () {
expect(checkNodeVisibility(browser, 'server')).toEqual(true);
});
});
});
});
});

View File

@@ -7,7 +7,7 @@
//
//////////////////////////////////////////////////////////////////////////
import keyboardShortcuts from 'sources/keyboard_shortcuts';
import * as keyboardShortcuts from 'sources/keyboard_shortcuts';
describe('the keyboard shortcuts', () => {
const F1_KEY = 112;

View File

@@ -28,7 +28,7 @@ describe('In charting related testcases', ()=> {
});
it('Return the correct container', ()=>{
expect(chartObj.getContainer()).toBe(chartDiv);
expect(chartObj.getContainer()).toEqual(chartDiv);
});
it('Returns the container dimensions', ()=>{
@@ -74,7 +74,7 @@ describe('In charting related testcases', ()=> {
});
it('Check if other data returns undefined for not set', ()=>{
expect(chartObj.getOtherData('some_val_not_set')).toBe(undefined);
expect(chartObj.getOtherData('some_val_not_set')).toEqual(undefined);
});
it('Check if isVisible returns correct', ()=>{
@@ -83,19 +83,19 @@ describe('In charting related testcases', ()=> {
dimSpy.and.returnValue({
height: 1, width: 1,
});
expect(chartObj.isVisible()).toBe(true);
expect(chartObj.isVisible()).toEqual(true);
dimSpy.and.stub();
dimSpy.and.returnValue({
height: 0, width: 0,
});
expect(chartObj.isVisible()).toBe(false);
expect(chartObj.isVisible()).toEqual(false);
});
it('Check if isInPage returns correct', ()=>{
expect(chartObj.isInPage()).toBe(true);
expect(chartObj.isInPage()).toEqual(true);
$('body').find('#charting-test-container').remove();
expect(chartObj.isInPage()).toBe(false);
expect(chartObj.isInPage()).toEqual(false);
});
afterEach(()=>{

View File

@@ -54,7 +54,7 @@ describe('#getPanelTitle', () => {
tree.selectNode([{id: 'level1'}]);
expect(getPanelTitle(pgBrowser))
.toBe('other db label/some user name@server label');
.toEqual('other db label/some user name@server label');
});
});
@@ -75,7 +75,7 @@ describe('#getPanelTitle', () => {
new TreeNode('level1.1.1', {_type: 'table'}));
tree.selectNode([{id: 'level1.1.1'}]);
expect(getPanelTitle(pgBrowser))
.toBe('db label/some user name@server label');
.toEqual('db label/some user name@server label');
});
});
});

View File

@@ -66,19 +66,19 @@ describe('getProcedureId', function () {
describe('Should return proper object id', function () {
it('returns valid procedure id', function () {
expect(getProcedureId(treeInfroProc)).toBe(123);
expect(getProcedureId(treeInfroProc)).toEqual(123);
});
it('returns valid edbproc id', function () {
expect(getProcedureId(treeInfroEdbProc)).toBe(321);
expect(getProcedureId(treeInfroEdbProc)).toEqual(321);
});
it('returns undefined for fake tree info', function () {
expect(getProcedureId(fakeTreeInfro)).toBe(undefined);
expect(getProcedureId(fakeTreeInfro)).toEqual(undefined);
});
it('returns undefined for invalid procedure id', function () {
expect(getProcedureId(treeInfroInvalidProcId)).toBe(undefined);
expect(getProcedureId(treeInfroInvalidProcId)).toEqual(undefined);
});
});
});

View File

@@ -67,7 +67,7 @@ describe('dialogTabNavigator', function () {
};
tabNavigator = new dialogTabNavigator.dialogTabNavigator(
dialog, backward_shortcut, forward_shortcut);
dialog, backward_shortcut, forward_shortcut);
});
describe('navigate', function () {

View File

@@ -55,7 +55,7 @@ describe('geometry viewer test', function () {
];
let columnIndex = 0;
let result = GeometryViewer.parse_data(items, columns, columnIndex);
expect(result.geoJSONs.length).toBe(2);
expect(result.geoJSONs.length).toEqual(2);
});
@@ -76,7 +76,7 @@ describe('geometry viewer test', function () {
];
let columnIndex = 0;
let result = GeometryViewer.parse_data(items, columns, columnIndex);
expect(result.geoJSONs.length).toBe(1);
expect(result.geoJSONs.length).toEqual(1);
});
it('should support geometry M', function () {
@@ -96,7 +96,7 @@ describe('geometry viewer test', function () {
];
let columnIndex = 0;
let result = GeometryViewer.parse_data(items, columns, columnIndex);
expect(result.geoJSONs.length).toBe(1);
expect(result.geoJSONs.length).toEqual(1);
});
it('should support empty geometry', function () {
@@ -114,7 +114,7 @@ describe('geometry viewer test', function () {
];
let columnIndex = 0;
let result = GeometryViewer.parse_data(items, columns, columnIndex);
expect(result.geoJSONs.length).toBe(1);
expect(result.geoJSONs.length).toEqual(1);
});
@@ -145,7 +145,7 @@ describe('geometry viewer test', function () {
];
let columnIndex = 0;
let result = GeometryViewer.parse_data(items, columns, columnIndex);
expect(result.geoJSONs.length).toBe(2);
expect(result.geoJSONs.length).toEqual(2);
});
@@ -164,7 +164,7 @@ describe('geometry viewer test', function () {
];
let columnIndex = 0;
let result = GeometryViewer.parse_data(items, columns, columnIndex);
expect(result.geoJSONs.length).toBe(0);
expect(result.geoJSONs.length).toEqual(0);
});
it('should not support 3DM geometry', function () {
@@ -183,7 +183,7 @@ describe('geometry viewer test', function () {
];
let columnIndex = 0;
let result = GeometryViewer.parse_data(items, columns, columnIndex);
expect(result.geoJSONs.length).toBe(0);
expect(result.geoJSONs.length).toEqual(0);
});
it('should not support TRIANGLE geometry', function () {
@@ -203,7 +203,7 @@ describe('geometry viewer test', function () {
];
let columnIndex = 0;
let result = GeometryViewer.parse_data(items, columns, columnIndex);
expect(result.geoJSONs.length).toBe(0);
expect(result.geoJSONs.length).toEqual(0);
});
it('should limit data size', function () {

View File

@@ -25,11 +25,11 @@ describe('historyCollection', function () {
it('returns 0 when underlying history model has no elements', function () {
historyCollection = new HistoryCollection([]);
expect(historyCollection.length()).toBe(0);
expect(historyCollection.length()).toEqual(0);
});
it('returns the length of the underlying history model', function () {
expect(historyCollection.length()).toBe(1);
expect(historyCollection.length()).toEqual(1);
});
});
@@ -61,7 +61,7 @@ describe('historyCollection', function () {
it('drops the history', function () {
expect(historyCollection.historyList).toEqual([]);
expect(historyCollection.length()).toBe(0);
expect(historyCollection.length()).toEqual(0);
});
it('calls the onReset function', function () {

View File

@@ -32,7 +32,7 @@ describe('ExplainStatistics', () => {
statsModel.set('Triggers', []);
statsModel.set_statistics(tooltipContainer);
expect($('.pg-explain-stats-area').hasClass('d-none')).toBe(true);
expect($('.pg-explain-stats-area').hasClass('d-none')).toEqual(true);
});
});
@@ -45,7 +45,7 @@ describe('ExplainStatistics', () => {
});
it('Statistics button should be visible', () => {
expect($('.pg-explain-stats-area').hasClass('d-none')).toBe(false);
expect($('.pg-explain-stats-area').hasClass('d-none')).toEqual(false);
});
it('Mouse over event should be trigger', () => {
@@ -53,7 +53,7 @@ describe('ExplainStatistics', () => {
var hoverEvent = new $.Event('mouseover');
$('.pg-explain-stats-area').trigger(hoverEvent);
expect(tooltipContainer.css('opacity')).toBe('0.8');
expect(tooltipContainer.css('opacity')).toEqual('0.8');
});
it('Mouse out event should be trigger', () => {
@@ -61,7 +61,7 @@ describe('ExplainStatistics', () => {
var hoverEvent = new $.Event('mouseout');
$('.pg-explain-stats-area').trigger(hoverEvent);
expect(tooltipContainer.css('opacity')).toBe('0');
expect(tooltipContainer.css('opacity')).toEqual('0');
});
});
@@ -74,7 +74,7 @@ describe('ExplainStatistics', () => {
});
it('Statistics button should be visible', () => {
expect($('.pg-explain-stats-area').hasClass('d-none')).toBe(false);
expect($('.pg-explain-stats-area').hasClass('d-none')).toEqual(false);
});
it('Mouse over event should be trigger', () => {
@@ -82,7 +82,7 @@ describe('ExplainStatistics', () => {
var hoverEvent = new $.Event('mouseover');
$('.pg-explain-stats-area').trigger(hoverEvent);
expect(tooltipContainer.css('opacity')).toBe('0.8');
expect(tooltipContainer.css('opacity')).toEqual('0.8');
});
it('Mouse out event should be trigger', () => {
@@ -90,7 +90,7 @@ describe('ExplainStatistics', () => {
var hoverEvent = new $.Event('mouseout');
$('.pg-explain-stats-area').trigger(hoverEvent);
expect(tooltipContainer.css('opacity')).toBe('0');
expect(tooltipContainer.css('opacity')).toEqual('0');
});
});
});

View File

@@ -15,7 +15,7 @@ describe('#nodeHasStatistics', () => {
const node = {
hasStatistics: true,
};
expect(nodeHasStatistics(node, {})).toBe(true);
expect(nodeHasStatistics(node, {})).toEqual(true);
});
});
@@ -28,7 +28,7 @@ describe('#nodeHasStatistics', () => {
};
const item = {};
expect(nodeHasStatistics(node, item)).toBe(true);
expect(nodeHasStatistics(node, item)).toEqual(true);
expect(node.getTreeNodeHierarchy).toHaveBeenCalledWith(item);
});
});

View File

@@ -115,7 +115,7 @@ describe('RestoreDialogWrapper', () => {
it('disables the button "submit button" until a filename is selected', () => {
restoreDialogWrapper.prepare();
expect(restoreDialogWrapper.__internal.buttons[3].element.disabled).toBe(true);
expect(restoreDialogWrapper.__internal.buttons[3].element.disabled).toEqual(true);
});
});
@@ -131,7 +131,7 @@ describe('RestoreDialogWrapper', () => {
it('disables the button "submit button" until a filename is selected', () => {
restoreDialogWrapper.prepare();
expect(restoreDialogWrapper.__internal.buttons[3].element.disabled).toBe(true);
expect(restoreDialogWrapper.__internal.buttons[3].element.disabled).toEqual(true);
});
});
@@ -177,7 +177,7 @@ describe('RestoreDialogWrapper', () => {
it('disables the button submit button until a filename is selected', () => {
restoreDialogWrapper.prepare();
expect(restoreNode.__internal.buttons[3].element.disabled).toBe(true);
expect(restoreNode.__internal.buttons[3].element.disabled).toEqual(true);
});
it('generates a new restore model', () => {
@@ -257,7 +257,7 @@ describe('RestoreDialogWrapper', () => {
});
it('does not start the restore', () => {
expect(networkCalled).toBe(false);
expect(networkCalled).toEqual(false);
});
});
@@ -298,7 +298,7 @@ describe('RestoreDialogWrapper', () => {
});
it('does not start the restore', () => {
expect(networkCalled).toBe(false);
expect(networkCalled).toEqual(false);
});
});
@@ -327,7 +327,7 @@ describe('RestoreDialogWrapper', () => {
it('does not start the restore', () => {
restoreDialogWrapper.callback(event);
expect(networkCalled).toBe(false);
expect(networkCalled).toEqual(false);
});
});
@@ -353,7 +353,7 @@ describe('RestoreDialogWrapper', () => {
it('does not start the restore', () => {
restoreDialogWrapper.callback(event);
expect(networkCalled).toBe(false);
expect(networkCalled).toEqual(false);
});
});

View File

@@ -100,7 +100,7 @@ describe('ColumnSelector', function () {
var columnSelector = new ColumnSelector();
var selectableColumns = columnSelector.getColumnDefinitions(columns);
expect(selectableColumns[1].id).toBe('1');
expect(selectableColumns[1].id).toEqual('1');
});
describe('with ActiveCellCapture, CellSelectionModel, and GridSelector: selecting columns', function () {
@@ -142,11 +142,11 @@ describe('ColumnSelector', function () {
it('toggles a selected class to the header cell', function () {
container.find('.slick-header-column:contains(second column)').click();
expect($(container.find('.slick-header-column:contains(second column)')).hasClass('selected'))
.toBe(true);
.toEqual(true);
container.find('.slick-header-column:contains(second column)').click();
expect($(container.find('.slick-header-column:contains(second column)')).hasClass('selected'))
.toBe(false);
.toEqual(false);
});
});
@@ -160,14 +160,14 @@ describe('ColumnSelector', function () {
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(2);
expect(selectedRanges.length).toEqual(2);
var column1 = selectedRanges[0];
expect(column1.fromCell).toBe(1);
expect(column1.toCell).toBe(1);
expect(column1.fromCell).toEqual(1);
expect(column1.toCell).toEqual(1);
var column2 = selectedRanges[1];
expect(column2.fromCell).toBe(2);
expect(column2.toCell).toBe(2);
expect(column2.fromCell).toEqual(2);
expect(column2.toCell).toEqual(2);
});
describe('and presses shift + right-arrow', function () {
@@ -176,24 +176,24 @@ describe('ColumnSelector', function () {
});
it('keeps the last column selected', function () {
expect(cellSelectionModel.getSelectedRanges().length).toBe(1);
expect(cellSelectionModel.getSelectedRanges().length).toEqual(1);
});
it('grows the selection to the right', function () {
var selectedRange = cellSelectionModel.getSelectedRanges()[0];
expect(selectedRange.fromCell).toBe(2);
expect(selectedRange.toCell).toBe(3);
expect(selectedRange.fromRow).toBe(0);
expect(selectedRange.toRow).toBe(9);
expect(selectedRange.fromCell).toEqual(2);
expect(selectedRange.toCell).toEqual(3);
expect(selectedRange.fromRow).toEqual(0);
expect(selectedRange.toRow).toEqual(9);
});
it('keeps selected class on columns 2 and 3', function () {
expect($(container.find('.slick-header-column:contains(second column)')).hasClass('selected'))
.toBe(true);
.toEqual(true);
expect($(container.find('.slick-header-column:contains(third column)')).hasClass('selected'))
.toBe(true);
.toEqual(true);
expect($(container.find('.slick-header-column:contains(some-column-name)')).hasClass('selected'))
.toBe(false);
.toEqual(false);
});
});
@@ -208,11 +208,11 @@ describe('ColumnSelector', function () {
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges[0].fromCell).toBe(1);
expect(selectedRanges[0].toCell).toBe(2);
expect(selectedRanges[0].fromRow).toBe(0);
expect(selectedRanges[0].toRow).toBe(9);
expect(selectedRanges.length).toEqual(1);
expect(selectedRanges[0].fromCell).toEqual(1);
expect(selectedRanges[0].toCell).toEqual(2);
expect(selectedRanges[0].fromRow).toEqual(0);
expect(selectedRanges[0].toRow).toEqual(9);
});
});
});
@@ -229,11 +229,11 @@ describe('ColumnSelector', function () {
it('toggles a selected class to the header cell', function () {
container.find('.slick-header-column span.column-description:contains(second column)').click();
expect($(container.find('.slick-header-column:contains(second column)')).hasClass('selected'))
.toBe(true);
.toEqual(true);
container.find('.slick-header-column span.column-description:contains(second column)').click();
expect($(container.find('.slick-header-column:contains(second column)')).hasClass('selected'))
.toBe(false);
.toEqual(false);
});
});
@@ -247,14 +247,14 @@ describe('ColumnSelector', function () {
container.find('.slick-header-column')[1].click();
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges.length).toEqual(1);
var column = selectedRanges[0];
expect(column.fromCell).toBe(1);
expect(column.toCell).toBe(1);
expect(column.fromRow).toBe(0);
expect(column.toRow).toBe(9);
expect(column.fromCell).toEqual(1);
expect(column.toCell).toEqual(1);
expect(column.fromRow).toEqual(0);
expect(column.toRow).toEqual(9);
});
});
@@ -289,7 +289,7 @@ describe('ColumnSelector', function () {
cellSelectionModel.setSelectedRanges([]);
expect($(container.find('.slick-header-column')[1]).hasClass('selected'))
.toBe(false);
.toEqual(false);
});
});
@@ -321,14 +321,14 @@ describe('ColumnSelector', function () {
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges.length).toEqual(1);
var column = selectedRanges[0];
expect(column.fromCell).toBe(1);
expect(column.toCell).toBe(1);
expect(column.fromRow).toBe(1);
expect(column.toRow).toBe(1);
expect(column.fromCell).toEqual(1);
expect(column.toCell).toEqual(1);
expect(column.fromRow).toEqual(1);
expect(column.toRow).toEqual(1);
});
it('keep select class on column header', function () {
@@ -346,14 +346,14 @@ describe('ColumnSelector', function () {
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges.length).toEqual(1);
var column = selectedRanges[0];
expect(column.fromCell).toBe(2);
expect(column.toCell).toBe(2);
expect(column.fromRow).toBe(2);
expect(column.toRow).toBe(2);
expect(column.fromCell).toEqual(2);
expect(column.toCell).toEqual(2);
expect(column.fromRow).toEqual(2);
expect(column.toRow).toEqual(2);
});
it('remove select class on \'some-column-name\' column header', function () {
@@ -373,14 +373,14 @@ describe('ColumnSelector', function () {
it('column is deselected', function () {
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges.length).toEqual(1);
var column = selectedRanges[0];
expect(column.fromCell).toBe(1);
expect(column.toCell).toBe(3);
expect(column.fromRow).toBe(1);
expect(column.toRow).toBe(1);
expect(column.fromCell).toEqual(1);
expect(column.toCell).toEqual(3);
expect(column.fromRow).toEqual(1);
expect(column.toRow).toEqual(1);
});
it('no column should have the class \'selected\'', function () {
@@ -407,10 +407,10 @@ describe('ColumnSelector', function () {
var row = selectedRanges[0];
expect(selectedRanges.length).toEqual(1);
expect(row.fromCell).toBe(1);
expect(row.toCell).toBe(1);
expect(row.fromRow).toBe(0);
expect(row.toRow).toBe(9);
expect(row.fromCell).toEqual(1);
expect(row.toCell).toEqual(1);
expect(row.fromRow).toEqual(0);
expect(row.toRow).toEqual(9);
}
function pressShiftArrow(keyCode) {

View File

@@ -88,11 +88,11 @@ describe('copyData', function () {
});
it('copies them', function () {
spyOn(clipboard, 'copyTextToClipboard');
spyOn(clipboard, 'copyTextToClipboard').and.callThrough();
copyData.apply(sqlEditor);
expect(sqlEditor.copied_rows.length).toBe(2);
expect(sqlEditor.copied_rows.length).toEqual(2);
expect(clipboard.copyTextToClipboard).toHaveBeenCalled();
expect(clipboard.copyTextToClipboard.calls.mostRecent().args[0]).toContain('1,"leopord",12');
@@ -103,7 +103,7 @@ describe('copyData', function () {
it('enables the paste row button', function () {
copyData.apply(_.extend({can_edit: true}, sqlEditor));
expect($('#btn-paste-row').prop('disabled')).toBe(false);
expect($('#btn-paste-row').prop('disabled')).toEqual(false);
});
});
});
@@ -123,15 +123,15 @@ describe('copyData', function () {
var copyArg = clipboard.copyTextToClipboard.calls.mostRecent().args[0];
var rowStrings = copyArg.split('\n');
expect(rowStrings[0]).toBe('1');
expect(rowStrings[1]).toBe('2');
expect(rowStrings[2]).toBe('3');
expect(rowStrings[0]).toEqual('1');
expect(rowStrings[1]).toEqual('2');
expect(rowStrings[2]).toEqual('3');
});
it('sets copied_rows to empty', function () {
copyData.apply(sqlEditor);
expect(sqlEditor.copied_rows.length).toBe(0);
expect(sqlEditor.copied_rows.length).toEqual(0);
});
describe('when the user can edit the grid', function () {
@@ -140,7 +140,7 @@ describe('copyData', function () {
});
it('disables the paste row button', function () {
expect($('#btn-paste-row').prop('disabled')).toBe(true);
expect($('#btn-paste-row').prop('disabled')).toEqual(true);
});
});
});

View File

@@ -56,14 +56,14 @@ describe('GridSelector', function () {
});
it('renders an additional column on the left for selecting rows', function () {
expect(columns.length).toBe(3);
expect(columns.length).toEqual(3);
var leftmostColumn = columns[0];
expect(leftmostColumn.id).toBe('row-header-column');
expect(leftmostColumn.id).toEqual('row-header-column');
});
it('renders a button for selecting all the cells', function () {
expect(container.find('[title=\'Select/Deselect All\']').length).toBe(1);
expect(container.find('[title=\'Select/Deselect All\']').length).toEqual(1);
});
describe('when the cell for the select/deselect all is clicked', function () {
@@ -71,12 +71,12 @@ describe('GridSelector', function () {
container.find('[title=\'Select/Deselect All\']').parent().trigger('click');
var selectedRanges = xCellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges.length).toEqual(1);
var selectedRange = selectedRanges[0];
expect(selectedRange.fromCell).toBe(1);
expect(selectedRange.toCell).toBe(2);
expect(selectedRange.fromRow).toBe(0);
expect(selectedRange.toRow).toBe(9);
expect(selectedRange.fromCell).toEqual(1);
expect(selectedRange.toCell).toEqual(2);
expect(selectedRange.fromRow).toEqual(0);
expect(selectedRange.toRow).toEqual(9);
});
it('adds selected class', function () {
@@ -92,12 +92,12 @@ describe('GridSelector', function () {
container.find('[title=\'Select/Deselect All\']').trigger('click');
var selectedRanges = xCellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges.length).toEqual(1);
var selectedRange = selectedRanges[0];
expect(selectedRange.fromCell).toBe(1);
expect(selectedRange.toCell).toBe(2);
expect(selectedRange.fromRow).toBe(0);
expect(selectedRange.toRow).toBe(9);
expect(selectedRange.fromCell).toEqual(1);
expect(selectedRange.toCell).toEqual(2);
expect(selectedRange.fromRow).toEqual(0);
expect(selectedRange.toRow).toEqual(9);
});
describe('when the select all button in the corner gets deselected', function () {
@@ -109,7 +109,7 @@ describe('GridSelector', function () {
container.find('[title=\'Select/Deselect All\']').trigger('click');
var selectedRanges = xCellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(0);
expect(selectedRanges.length).toEqual(0);
});
});

View File

@@ -66,22 +66,22 @@ describe('RowSelector', function () {
});
it('renders an additional column on the left', function () {
expect(columnDefinitions.length).toBe(3);
expect(columnDefinitions.length).toEqual(3);
var leftmostColumn = columnDefinitions[0];
expect(leftmostColumn.id).toBe('row-header-column');
expect(leftmostColumn.name).toBe('');
expect(leftmostColumn.selectable).toBe(false);
expect(leftmostColumn.id).toEqual('row-header-column');
expect(leftmostColumn.name).toEqual('');
expect(leftmostColumn.selectable).toEqual(false);
});
it('renders a span on the leftmost column', function () {
expect(container.find('.slick-row').length).toBe(10);
expect(container.find('.slick-row .slick-cell:first-child span[data-cell-type="row-header-selector"]').length).toBe(10);
expect(container.find('.slick-row').length).toEqual(10);
expect(container.find('.slick-row .slick-cell:first-child span[data-cell-type="row-header-selector"]').length).toEqual(10);
});
it('preserves the other attributes of column definitions', function () {
expect(columnDefinitions[1].id).toBe('1');
expect(columnDefinitions[1].selectable).toBe(true);
expect(columnDefinitions[1].id).toEqual('1');
expect(columnDefinitions[1].selectable).toEqual(true);
});
describe('selecting rows', function () {
@@ -112,10 +112,10 @@ describe('RowSelector', function () {
var row = selectedRanges[0];
expect(selectedRanges.length).toEqual(1);
expect(row.fromCell).toBe(1);
expect(row.toCell).toBe(2);
expect(row.fromRow).toBe(1);
expect(row.toRow).toBe(1);
expect(row.fromCell).toEqual(1);
expect(row.toCell).toEqual(2);
expect(row.fromRow).toEqual(1);
expect(row.toRow).toEqual(1);
});
it('add selected class to parent of the span', function () {
@@ -139,7 +139,7 @@ describe('RowSelector', function () {
});
it('keeps the last row selected', function () {
expect(cellSelectionModel.getSelectedRanges().length).toBe(1);
expect(cellSelectionModel.getSelectedRanges().length).toEqual(1);
});
it('grows the selection down', function () {
@@ -148,10 +148,10 @@ describe('RowSelector', function () {
var row = selectedRanges[0];
expect(selectedRanges.length).toEqual(1);
expect(row.fromCell).toBe(1);
expect(row.toCell).toBe(2);
expect(row.fromRow).toBe(1);
expect(row.toRow).toBe(2);
expect(row.fromCell).toEqual(1);
expect(row.toCell).toEqual(2);
expect(row.fromRow).toEqual(1);
expect(row.toRow).toEqual(2);
});
it('keeps selected class on rows 1 and 2', function () {
@@ -175,14 +175,14 @@ describe('RowSelector', function () {
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges.length).toEqual(1);
var newSelection = selectedRanges[0];
expect(newSelection.fromCell).toBe(1);
expect(newSelection.fromRow).toBe(5);
expect(newSelection.toCell).toBe(1);
expect(newSelection.toRow).toBe(5);
expect(newSelection.fromCell).toEqual(1);
expect(newSelection.fromRow).toEqual(5);
expect(newSelection.toCell).toEqual(1);
expect(newSelection.toRow).toEqual(5);
});
it('keep select class on row header', function () {
@@ -200,14 +200,14 @@ describe('RowSelector', function () {
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges.length).toEqual(1);
var newSelection = selectedRanges[0];
expect(newSelection.fromCell).toBe(2);
expect(newSelection.fromRow).toBe(2);
expect(newSelection.toCell).toBe(2);
expect(newSelection.toRow).toBe(2);
expect(newSelection.fromCell).toEqual(2);
expect(newSelection.fromRow).toEqual(2);
expect(newSelection.toCell).toEqual(2);
expect(newSelection.toRow).toEqual(2);
});
it('remove select class on "some-column-name" column header', function () {
@@ -250,12 +250,12 @@ describe('RowSelector', function () {
expect(selectedRanges.length).toEqual(2);
var row1 = selectedRanges[0];
expect(row1.fromRow).toBe(4);
expect(row1.toRow).toBe(4);
expect(row1.fromRow).toEqual(4);
expect(row1.toRow).toEqual(4);
var row2 = selectedRanges[1];
expect(row2.fromRow).toBe(0);
expect(row2.toRow).toBe(0);
expect(row2.fromRow).toEqual(0);
expect(row2.toRow).toEqual(0);
});
});
@@ -320,9 +320,9 @@ describe('RowSelector', function () {
var row = selectedRanges[0];
expect(selectedRanges.length).toEqual(1);
expect(row.fromCell).toBe(1);
expect(row.toCell).toBe(2);
expect(row.fromRow).toBe(0);
expect(row.toRow).toBe(0);
expect(row.fromCell).toEqual(1);
expect(row.toCell).toEqual(2);
expect(row.fromRow).toEqual(0);
expect(row.toRow).toEqual(0);
}
});

View File

@@ -437,12 +437,12 @@ describe('XCellSelectionModel', function () {
it('should call handleDragEnd from CellRangeSelector', function () {
var newRange = grid.getSelectionModel().getSelectedRanges();
expect(newRange.length).toBe(1);
expect(newRange.length).toEqual(1);
expect(newRange[0].fromCell).toBe(1);
expect(newRange[0].toCell).toBe(3);
expect(newRange[0].fromRow).toBe(1);
expect(newRange[0].toRow).toBe(4);
expect(newRange[0].fromCell).toEqual(1);
expect(newRange[0].toCell).toEqual(3);
expect(newRange[0].fromRow).toEqual(1);
expect(newRange[0].toRow).toEqual(4);
});
});
});
@@ -482,7 +482,7 @@ describe('XCellSelectionModel', function () {
var selectedRanges = grid.getSelectionModel().getSelectedRanges();
expect(selectedRanges.length).toBe(2);
expect(selectedRanges.length).toEqual(2);
expectRangeToMatch(selectedRanges[0], 0, 1, 0, 3);
expectRangeToMatch(selectedRanges[1], 2, 1, 2, 3);
});
@@ -505,14 +505,14 @@ describe('XCellSelectionModel', function () {
function expectOneSelectedRange(fromRow, fromCell, toRow, toCell) {
var selectedRanges = grid.getSelectionModel().getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges.length).toEqual(1);
expectRangeToMatch(selectedRanges[0], fromRow, fromCell, toRow, toCell);
}
function expectRangeToMatch(range, fromRow, fromCell, toRow, toCell) {
expect(range.fromRow).toBe(fromRow);
expect(range.toRow).toBe(toRow);
expect(range.fromCell).toBe(fromCell);
expect(range.toCell).toBe(toCell);
expect(range.fromRow).toEqual(fromRow);
expect(range.toRow).toEqual(toRow);
expect(range.fromCell).toEqual(fromCell);
expect(range.toCell).toEqual(toCell);
}
});

View File

@@ -57,11 +57,11 @@ describe('CellSelector', function () {
$(container.find('.slick-row .slick-cell.l' + column)[row]).trigger('click');
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toBe(1);
expect(selectedRanges[0].fromCell).toBe(0);
expect(selectedRanges[0].toCell).toBe(0);
expect(selectedRanges[0].fromRow).toBe(1);
expect(selectedRanges[0].toRow).toBe(1);
expect(selectedRanges.length).toEqual(1);
expect(selectedRanges[0].fromCell).toEqual(0);
expect(selectedRanges[0].toCell).toEqual(0);
expect(selectedRanges[0].fromRow).toEqual(1);
expect(selectedRanges[0].toRow).toEqual(1);
});
it('deselects previously selected ranges', function () {
@@ -74,7 +74,7 @@ describe('CellSelector', function () {
$(container.find('.slick-row .slick-cell.l' + column)[row]).trigger('click');
expect(RangeSelectionHelper.isRangeSelected(cellSelectionModel.getSelectedRanges(), row2Range))
.toBe(false);
.toEqual(false);
});
});
});

View File

@@ -95,7 +95,7 @@ describe('#handleQueryOutputKeyboardEvent', function () {
handleQueryOutputKeyboardEvent(event, slickEvent);
expect(RangeSelectionHelper.isEntireGridSelected(grid)).toBeTruthy();
expect(grid.getSelectionModel().getSelectedRanges().length).toBe(1);
expect(grid.getSelectionModel().getSelectedRanges().length).toEqual(1);
});
});
@@ -109,7 +109,7 @@ describe('#handleQueryOutputKeyboardEvent', function () {
handleQueryOutputKeyboardEvent(event, slickEvent);
expect(RangeSelectionHelper.isEntireGridSelected(grid)).toBeTruthy();
expect(grid.getSelectionModel().getSelectedRanges().length).toBe(1);
expect(grid.getSelectionModel().getSelectedRanges().length).toEqual(1);
});
});
});
@@ -125,7 +125,7 @@ describe('#handleQueryOutputKeyboardEvent', function () {
handleQueryOutputKeyboardEvent(event, slickEvent);
expect(RangeSelectionHelper.isEntireGridSelected(grid)).toBeTruthy();
expect(grid.getSelectionModel().getSelectedRanges().length).toBe(1);
expect(grid.getSelectionModel().getSelectedRanges().length).toEqual(1);
});
});
@@ -139,7 +139,7 @@ describe('#handleQueryOutputKeyboardEvent', function () {
handleQueryOutputKeyboardEvent(event, slickEvent);
expect(RangeSelectionHelper.isEntireGridSelected(grid)).toBeTruthy();
expect(grid.getSelectionModel().getSelectedRanges().length).toBe(1);
expect(grid.getSelectionModel().getSelectedRanges().length).toEqual(1);
});
});
});

View File

@@ -30,7 +30,7 @@ describe('#calculateQueryRunTime', () => {
seconds:21,
milliseconds:70}).toDate();
expect(calculateQueryRunTime(startDate, endDate))
.toEqual('947 msec');
.toEqual('947 msec');
});
});
@@ -53,7 +53,7 @@ describe('#calculateQueryRunTime', () => {
seconds:15,
milliseconds:70}).toDate();
expect(calculateQueryRunTime(startDate, endDate))
.toEqual('54 secs 947 msec');
.toEqual('54 secs 947 msec');
});
});
@@ -76,7 +76,7 @@ describe('#calculateQueryRunTime', () => {
seconds:15,
milliseconds:70}).toDate();
expect(calculateQueryRunTime(startDate, endDate))
.toEqual('9 min 54 secs');
.toEqual('9 min 54 secs');
});
});
@@ -99,7 +99,7 @@ describe('#calculateQueryRunTime', () => {
seconds:15,
milliseconds:70}).toDate();
expect(calculateQueryRunTime(startDate, endDate))
.toEqual('1 hr 9 min');
.toEqual('1 hr 9 min');
});
});
});

View File

@@ -1054,7 +1054,7 @@ describe('ExecuteQuery', () => {
executeQuery.execute('', {});
setTimeout(() => {
expect(wasNetworkCalled).toBe(false);
expect(wasNetworkCalled).toEqual(false);
done();
}, 0);
});
@@ -1129,7 +1129,7 @@ describe('ExecuteQuery', () => {
});
it('reset the number of rows that were affected', () => {
expect(sqlEditorMock.rows_affected).toBe(0);
expect(sqlEditorMock.rows_affected).toEqual(0);
});
it('reset query start time', () => {
@@ -1157,21 +1157,21 @@ describe('ExecuteQuery', () => {
it('should update the can edit flag', (done) => {
setTimeout(() => {
expect(sqlEditorMock.can_edit).toBe(false);
expect(sqlEditorMock.can_edit).toEqual(false);
done();
}, 0);
});
it('should update the can filter flag', (done) => {
setTimeout(() => {
expect(sqlEditorMock.can_filter).toBe(false);
expect(sqlEditorMock.can_filter).toEqual(false);
done();
}, 0);
});
it('should update information notifier timeout', (done) => {
setTimeout(() => {
expect(sqlEditorMock.info_notifier_timeout).toBe(5);
expect(sqlEditorMock.info_notifier_timeout).toEqual(5);
done();
}, 0);
});

View File

@@ -7,7 +7,7 @@
//
//////////////////////////////////////////////////////////////////////////
import keyboardShortcuts from 'sources/keyboard_shortcuts';
import * as keyboardShortcuts from 'sources/keyboard_shortcuts';
import {queryToolActions} from 'sources/sqleditor/query_tool_actions';
import gettext from 'sources/gettext';
@@ -512,30 +512,30 @@ describe('the keyboard shortcuts', () => {
};
it('shortcut_key',()=>{
expect(keyboardShortcuts.shortcut_key(shortcut)).toBe('A');
expect(keyboardShortcuts.shortcut_key(shortcut)).toEqual('A');
});
it('shortcut_accesskey_title',()=>{
expect(keyboardShortcuts.shortcut_accesskey_title(
'Title', shortcut)).toBe(gettext('Title (accesskey + A)'));
'Title', shortcut)).toEqual(gettext('Title (accesskey + A)'));
});
it('shortcut_title',()=>{
shortcut.alt = true, shortcut.shift = false, shortcut.control = false;
expect(keyboardShortcuts.shortcut_title(
'Title', shortcut)).toBe(gettext('Title (Alt+A)'));
'Title', shortcut)).toEqual(gettext('Title (Alt+A)'));
shortcut.alt = false, shortcut.shift = true, shortcut.control = false;
expect(keyboardShortcuts.shortcut_title(
'Title', shortcut)).toBe(gettext('Title (Shift+A)'));
'Title', shortcut)).toEqual(gettext('Title (Shift+A)'));
shortcut.alt = false, shortcut.shift = false, shortcut.control = true;
expect(keyboardShortcuts.shortcut_title(
'Title', shortcut)).toBe(gettext('Title (Ctrl+A)'));
'Title', shortcut)).toEqual(gettext('Title (Ctrl+A)'));
shortcut.alt = true, shortcut.shift = true, shortcut.control = true;
expect(keyboardShortcuts.shortcut_title(
'Title', shortcut)).toBe(gettext('Title (Alt+Shift+Ctrl+A)'));
'Title', shortcut)).toEqual(gettext('Title (Alt+Shift+Ctrl+A)'));
});
});
@@ -617,7 +617,7 @@ describe('the keyboard shortcuts', () => {
describe('stops all event propogation', () => {
it('should cancel the bubble', () => {
expect(event.cancelBubble).toBe(true);
expect(event.cancelBubble).toEqual(true);
});
it('should prevent the default behavior', () => {

View File

@@ -474,13 +474,13 @@ describe('queryToolActions', () => {
it('toggle the selection and string should be in upper case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
).toHaveBeenCalledWith('STRING');
).toHaveBeenCalledWith('STRING');
});
it('(negative scenario toggle the selection and string should be in upper case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
).not.toHaveBeenCalledWith('string');
).not.toHaveBeenCalledWith('string');
});
});
@@ -492,13 +492,13 @@ describe('queryToolActions', () => {
it('toggle the selection and string should be in lower case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
).toHaveBeenCalledWith('string');
).toHaveBeenCalledWith('string');
});
it('(negative scenario toggle the selection and string should be in lower case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
).not.toHaveBeenCalledWith('STRING');
).not.toHaveBeenCalledWith('STRING');
});
});
@@ -510,13 +510,13 @@ describe('queryToolActions', () => {
it('toggle the selection and string should be in upper case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
).toHaveBeenCalledWith('STRING');
).toHaveBeenCalledWith('STRING');
});
it('(negative scenario toggle the selection and string should be in upper case', () => {
queryToolActions.toggleCaseOfSelectedText(sqlEditorController);
expect(replaceSelectionSpy
).not.toHaveBeenCalledWith('sTRIng');
).not.toHaveBeenCalledWith('sTRIng');
});
});
});

View File

@@ -17,7 +17,7 @@ describe('#httpResponseRequiresNewTransaction', () => {
it('should return false', () => {
expect(httpResponseRequiresNewTransaction({
status: 300,
})).toBe(false);
})).toEqual(false);
});
});
@@ -48,7 +48,7 @@ describe('#httpResponseRequiresNewTransaction', () => {
data: {
info: 'some information',
},
})).toBe(false);
})).toEqual(false);
});
});
@@ -59,7 +59,7 @@ describe('#httpResponseRequiresNewTransaction', () => {
data: {
info: 'DATAGRID_TRANSACTION_REQUIRED',
},
})).toBe(true);
})).toEqual(true);
});
});
});
@@ -79,8 +79,8 @@ describe('#handleQueryToolAjaxError', () => {
stateParameters = [];
checkTransaction = false;
sqlEditorHandler = jasmine.createSpyObj(
'handler', ['initTransaction', 'saveState', 'handle_connection_lost']
);
'handler', ['initTransaction', 'saveState', 'handle_connection_lost']
);
exceptionSpy = {
readyState: 0,
status: 404,
@@ -102,7 +102,7 @@ describe('#handleQueryToolAjaxError', () => {
pgBrowserMock, sqlEditorHandler, exceptionSpy, stateToSave,
stateParameters, checkTransaction
)
).toBe('Not connected to the server or the connection to the server has been closed.');
).toEqual('Not connected to the server or the connection to the server has been closed.');
});
});
@@ -184,7 +184,7 @@ describe('#handleQueryToolAjaxError', () => {
pgBrowserMock, sqlEditorHandler, exceptionSpy, stateToSave,
stateParameters, checkTransaction
)
).toBe('ajax failed with unknown reason');
).toEqual('ajax failed with unknown reason');
});
});

View File

@@ -8,89 +8,89 @@
//////////////////////////////////////////////////////////////////////////
define(['sources/sqleditor_utils'],
function (SqlEditorUtils) {
describe('SqlEditorUtils', function () {
function (SqlEditorUtils) {
describe('SqlEditorUtils', function () {
describe('Generate a random string of size 10', function () {
it('returns string of length 10', function () {
expect(SqlEditorUtils.epicRandomString(10).length).toEqual(10);
});
});
describe('Generate a unique hash for given string', function () {
it('returns unique hash', function () {
expect(SqlEditorUtils.getHash('select * from test')).toEqual(403379630);
});
});
describe('Capitalize the first letter of given string', function () {
it('returns string with First letter Capital', function () {
expect(SqlEditorUtils.capitalizeFirstLetter('create script')).toEqual('Create script');
});
});
describe('Calculate font size of input number passed', function () {
it('calcFontSize', function () {
expect(SqlEditorUtils.calcFontSize(1.456)).toEqual('1.46em');
expect(SqlEditorUtils.calcFontSize()).toEqual('1em');
expect(SqlEditorUtils.calcFontSize(2)).toEqual('2em');
});
});
describe('Remove the slashes', function () {
it('it will remove the slashes', function () {
expect(
SqlEditorUtils.removeSlashInTheString('/')
).toEqual({
'slashLocations': '0',
'title': '',
describe('Generate a random string of size 10', function () {
it('returns string of length 10', function () {
expect(SqlEditorUtils.epicRandomString(10).length).toEqual(10);
});
});
it('it will remove if slashes are present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('my/test')
).toEqual({
'slashLocations': '2',
'title': 'mytest',
describe('Generate a unique hash for given string', function () {
it('returns unique hash', function () {
expect(SqlEditorUtils.getHash('select * from test')).toEqual(403379630);
});
});
it('it will remove all the slashes are present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('my/test/value')
).toEqual({
'slashLocations': '2,7',
'title': 'mytestvalue',
describe('Capitalize the first letter of given string', function () {
it('returns string with First letter Capital', function () {
expect(SqlEditorUtils.capitalizeFirstLetter('create script')).toEqual('Create script');
});
});
it('it will remove all the slashes are present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('a/bb/ccc/dddd/eeeee')
).toEqual({
'slashLocations': '1,4,8,13',
'title': 'abbcccddddeeeee',
describe('Calculate font size of input number passed', function () {
it('calcFontSize', function () {
expect(SqlEditorUtils.calcFontSize(1.456)).toEqual('1.46em');
expect(SqlEditorUtils.calcFontSize()).toEqual('1em');
expect(SqlEditorUtils.calcFontSize(2)).toEqual('2em');
});
});
it('it will not remove if slash is not present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('mytest')
).toEqual({
'slashLocations': '',
'title': 'mytest',
describe('Remove the slashes', function () {
it('it will remove the slashes', function () {
expect(
SqlEditorUtils.removeSlashInTheString('/')
).toEqual({
'slashLocations': '0',
'title': '',
});
});
});
it('it will not remove if value is not present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('')
).toEqual({
'slashLocations': '',
'title': '',
it('it will remove if slashes are present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('my/test')
).toEqual({
'slashLocations': '2',
'title': 'mytest',
});
});
it('it will remove all the slashes are present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('my/test/value')
).toEqual({
'slashLocations': '2,7',
'title': 'mytestvalue',
});
});
it('it will remove all the slashes are present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('a/bb/ccc/dddd/eeeee')
).toEqual({
'slashLocations': '1,4,8,13',
'title': 'abbcccddddeeeee',
});
});
it('it will not remove if slash is not present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('mytest')
).toEqual({
'slashLocations': '',
'title': 'mytest',
});
});
it('it will not remove if value is not present', function () {
expect(
SqlEditorUtils.removeSlashInTheString('')
).toEqual({
'slashLocations': '',
'title': '',
});
});
});
});
});
});

View File

@@ -51,7 +51,7 @@ describe('#enableTriggers', () => {
});
setTimeout(() => {
expect(enableTriggers(tree, alertify, generateUrlSpy, {})).toBe(false);
expect(enableTriggers(tree, alertify, generateUrlSpy, {})).toEqual(false);
done();
}, 0);
});
@@ -66,7 +66,7 @@ describe('#enableTriggers', () => {
});
setTimeout(() => {
expect(enableTriggers(tree, alertify, generateUrlSpy, {})).toBe(false);
expect(enableTriggers(tree, alertify, generateUrlSpy, {})).toEqual(false);
}, 0);
});
});
@@ -134,7 +134,7 @@ describe('#enableTriggers', () => {
enableTriggers(tree, alertify, generateUrlSpy, {item: [{id: 'table1'}]});
setTimeout(() => {
expect(tree.findNodeByDomElement([{id: 'table1'}]).children.length).toBe(0);
expect(tree.findNodeByDomElement([{id: 'table1'}]).children.length).toEqual(0);
done();
}, 20);
});
@@ -178,7 +178,7 @@ describe('#disableTriggers', () => {
});
setTimeout(() => {
expect(disableTriggers(tree, alertify, generateUrlSpy, {})).toBe(false);
expect(disableTriggers(tree, alertify, generateUrlSpy, {})).toEqual(false);
done();
}, 0);
});
@@ -193,7 +193,7 @@ describe('#disableTriggers', () => {
});
setTimeout(() => {
expect(disableTriggers(tree, alertify, generateUrlSpy, {})).toBe(false);
expect(disableTriggers(tree, alertify, generateUrlSpy, {})).toEqual(false);
}, 0);
});
});
@@ -261,7 +261,7 @@ describe('#disableTriggers', () => {
disableTriggers(tree, alertify, generateUrlSpy, {item: [{id: 'table1'}]});
setTimeout(() => {
expect(tree.findNodeByDomElement([{id: 'table1'}]).children.length).toBe(0);
expect(tree.findNodeByDomElement([{id: 'table1'}]).children.length).toEqual(0);
done();
}, 20);
});

View File

@@ -12,6 +12,7 @@ import {pgBrowser, browserTreeState} from '../../../pgadmin/static/js/tree/pgadm
describe('#browserTreeState', () => {
beforeEach(() => {
pgBrowser.Nodes = {
server_group: {
_type: 'server_group',
@@ -192,10 +193,9 @@ describe('#browserTreeState', () => {
expect(browserTreeState.current_state, {1: {'paths': ['server_group/1,server/1,coll_database/1','database/10']}});
});
});
});
describe('When node is closed, node should get removed from the tree state cache', () => {
describe('When coll_database node is closed, both database and coll_database should be removed', () => {
let item = {
_type: 'coll_database',
@@ -212,6 +212,7 @@ describe('#browserTreeState', () => {
});
it('The tree current state will remove coll_database and database', () => {
browserTreeState.update_cache(item);
browserTreeState.remove_from_cache(item);
expect(browserTreeState.current_state, {1: {'paths': ['server_group/1,server/1']}});
});

View File

@@ -32,7 +32,7 @@ const treeTests = (treeClass, setDefaultCallBack) => {
it('return false for #hasParent()', () => {
const node = tree.findNode(['some new node']);
expect(node.hasParent()).toBe(false);
expect(node.hasParent()).toEqual(false);
});
it('return null for #parent()', () => {
@@ -53,7 +53,7 @@ const treeTests = (treeClass, setDefaultCallBack) => {
it('return false for #hasParent()', () => {
const node = tree.findNode(['some new node']);
expect(node.hasParent()).toBe(false);
expect(node.hasParent()).toEqual(false);
});
it('return null for #parent()', () => {
@@ -74,7 +74,7 @@ const treeTests = (treeClass, setDefaultCallBack) => {
it('return false for #hasParent()', () => {
const node = tree.findNode(['some new node']);
expect(node.hasParent()).toBe(false);
expect(node.hasParent()).toEqual(false);
});
it('return null for #parent()', () => {
@@ -99,7 +99,7 @@ const treeTests = (treeClass, setDefaultCallBack) => {
it('return true for #hasParent()', () => {
const node = tree.findNode(['parent node', 'some new node']);
expect(node.hasParent()).toBe(true);
expect(node.hasParent()).toEqual(true);
});
it('return "parent node" object for #parent()', () => {
@@ -119,7 +119,7 @@ const treeTests = (treeClass, setDefaultCallBack) => {
tree.addNewNode('some new node', {data: 'interesting 1'}, undefined, ['parent' +
' node']);
const parentNode = tree.findNode(['parent node']);
expect(parentNode.children.length).toBe(1);
expect(parentNode.children.length).toEqual(1);
});
it('updates the existing node data', () => {
@@ -217,20 +217,20 @@ describe('tree tests', () => {
context('parent is null', () => {
it('returns false', () => {
let treeNode = new TreeNode('123', {}, [], null);
expect(treeNode.hasParent()).toBe(false);
expect(treeNode.hasParent()).toEqual(false);
});
});
context('parent is undefined', () => {
it('returns false', () => {
let treeNode = new TreeNode('123', {}, [], undefined);
expect(treeNode.hasParent()).toBe(false);
expect(treeNode.hasParent()).toEqual(false);
});
});
context('parent exists', () => {
it('returns true', () => {
let parentNode = new TreeNode('456', {}, []);
let treeNode = new TreeNode('123', {}, [], parentNode);
expect(treeNode.hasParent()).toBe(true);
expect(treeNode.hasParent()).toEqual(true);
});
});
});
@@ -337,13 +337,13 @@ describe('tree tests', () => {
context('node is at the first level', () => {
it('returns false', () => {
expect(tree.hasParent([{id: 'level1'}])).toBe(false);
expect(tree.hasParent([{id: 'level1'}])).toEqual(false);
});
});
context('node is at the second level', () => {
it('returns true', () => {
expect(tree.hasParent([{id: 'level2'}])).toBe(true);
expect(tree.hasParent([{id: 'level2'}])).toEqual(true);
});
});
});