2017-06-08 12:41:56 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
|
//
|
2019-01-02 15:54:12 +05:30
|
|
|
// Copyright (C) 2013 - 2019, The pgAdmin Development Team
|
2017-06-08 12:41:56 +01:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2017-06-12 16:55:14 +01:00
|
|
|
define(['sources/sqleditor_utils'],
|
2017-06-08 12:41:56 +01:00
|
|
|
function (SqlEditorUtils) {
|
2017-06-12 16:55:14 +01:00
|
|
|
describe('SqlEditorUtils', function () {
|
2017-06-08 12:41:56 +01:00
|
|
|
|
2017-06-12 16:55:14 +01:00
|
|
|
describe('Generate a random string of size 10', function () {
|
|
|
|
|
it('returns string of length 10', function () {
|
2017-06-08 12:41:56 +01:00
|
|
|
expect(SqlEditorUtils.epicRandomString(10).length).toEqual(10);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2017-06-12 16:55:14 +01:00
|
|
|
describe('Generate a unique hash for given string', function () {
|
|
|
|
|
it('returns unique hash', function () {
|
2017-06-08 12:41:56 +01:00
|
|
|
expect(SqlEditorUtils.getHash('select * from test')).toEqual(403379630);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2017-06-15 12:19:47 +01:00
|
|
|
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');
|
|
|
|
|
});
|
|
|
|
|
});
|
2018-07-05 11:38:43 +01:00
|
|
|
|
|
|
|
|
describe('Calculate font size of input number passed', function () {
|
|
|
|
|
it('calcFontSize', function () {
|
|
|
|
|
expect(SqlEditorUtils.calcFontSize(1.456)).toEqual('1.46em');
|
2018-07-10 13:58:44 +01:00
|
|
|
expect(SqlEditorUtils.calcFontSize()).toEqual('1em');
|
2018-07-05 11:38:43 +01:00
|
|
|
expect(SqlEditorUtils.calcFontSize(2)).toEqual('2em');
|
|
|
|
|
});
|
|
|
|
|
});
|
2017-06-08 12:41:56 +01:00
|
|
|
});
|
|
|
|
|
});
|